Android Gradle - 缓存被锁定

标签 android gradle build

<分区>

我真的很困惑为什么这个文件被锁定了。

它只锁定了一个特定的项目,其他项目没问题,所以可能与我的构建文件有关,但是到目前为止它们一直运行良好。

"Error:Timeout waiting to lock cp_proj class cache for build file 'D:\Users\RU112828\Development\NavX Fuel - Trunk\Fuel-TestApp\test\build.gradle' (D:\Users\user\.gradle\caches\2.8\scripts\build_64jc2uvb9pu0rruzfn4eaqpd1\cp_proj). It is currently in use by another Gradle instance.
Owner PID: unknown
Our PID: 7444
Owner Operation: unknown
Our operation: Initialize cache
Lock file: D:\Users\RU112828\.gradle\caches\2.8\scripts\build_64jc2uvb9pu0rruzfn4eaqpd1\cp_proj\cache.properties.lock"

只有一个构建正在进行,没有同时构建。经过昨天的大量摆弄之后,我设法清除了缓存,它又恢复了生机。但是今天已经不是这种情况了,清除缓存后它仍然阻塞。

    buildscript {
    repositories {
        mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0+'
    }
}

apply plugin: 'com.android.application'
repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    androidTestCompile fileTree(dir: 'libs', include: 'robotium-solo-5.5.3.jar')
    //    compile 'com.android.support:appcompat-v7:23.1.1'
    compile files('libs/robotium-solo-5.5.3.jar')
}

android {
    compileSdkVersion 'android-15'
    buildToolsVersion '23.0.2'
    android {
        defaultConfig {
            minSdkVersion 15
        }

        lintOptions {
            abortOnError false
        }
        sourceSets
                {
                    androidTest
                            {
                                res.srcDirs = ['res']
                                assets.srcDirs = ['assets']
                            }
                }
    }

}

task assembleDebug(overwrite: true) {}

task copyTask(type: Copy) {
    from 'D:/Users/RU112828/Development/app/myapp.apk'
    into 'build/outputs/apk/'
    rename {
        'test-debug.apk'
    }

    exec { //TODO this is commented out when we do not need a fresh install, when running start up tests then we should un-comment this
        //Force app to uninstall before then being installed.
        commandLine 'cmd', '/c', 'adb', 'uninstall', 'com.my.package'

    }
}

assembleDebug.dependsOn copyTask

该构建脚本由 Robotium Recorder 生成,然后我添加了调整以在 assembleDebug 阶段强制卸载应用程序。

谁能告诉我一些关于为什么这个文件被锁定的见解。

谢谢

最佳答案

我在我的mac上遇到了这个问题,我只是强制关闭studio并重新打开它,然后一切正常

关于Android Gradle - 缓存被锁定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34807738/

相关文章:

eclipse - 将项目导入 Eclipse 时禁用 Maven 项目构建器

android - 在现有 View 上显示透明 View

Android - 如何使蓝牙始终开启?

android - 无法同步 Gradle,找不到 com.android.support :support-annotations:23. 3.0

android - Android Studio-Gradle同步失败

ios - XCode 11.5 升级后不显示 React-Native Image

xcode - xcode 中的 Bash 脚本返回 Shell 脚本调用错误

java - 打开/关闭 wifi 或 gps 时,我的 BroadcastReceiver 被调用两次?

android - 全屏使用 WebView 和 RelativeLayout 时的奇怪行为

java - 使用Jacoco或IntelliJ IDEA生成单独的覆盖率报告以进行测试