【问题标题】:Cache It is currently in use by another Gradle instance缓存 它当前正在被另一个 Gradle 实例使用
【发布时间】:2015-11-10 14:39:49
【问题描述】:

我不明白为什么会这样。

Gradle sync failed: Timeout waiting to lock buildscript class cache for build file '/Users/user/Documents/android-studio-pubble/App/build.gradle' (/Users/user/.gradle/caches/2.2.1/scripts/build_bqh4uod6cat7u5cm5qkoye2ky/ProjectScript/buildscript). It is currently in use by another Gradle instance.
         Owner PID: unknown
         Our PID: 909
         Owner Operation: unknown
         Our operation: Initialize cache
         Lock file: /Users/user/.gradle/caches/2.2.1/scripts/build_bqh4uod6cat7u5cm5qkoye2ky/ProjectScript/buildscript/cache.properties.lock
         Consult IDE log for more details (Help | Show Log)

一般的格斗是:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url '/Users/user/Documents/sdk/extras/android/m2repository' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
    }
}

应用 gradle 文件是:

apply plugin: 'com.android.application'

android {
    signingConfigs {
        pubblemod {
            keyAlias 'testapp'
            keyPassword 'testapp'
            storeFile file('/Users/user/Documents/sdk/testapp.keystore')
            storePassword 'testapp'
        }
    }
    compileSdkVersion 22
    buildToolsVersion '22.0.1'
    defaultConfig {
        applicationId "com.test.app"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {

        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.intellij:annotations:+@jar'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.0'
    compile 'com.android.support:support-v13:22.0.+'
    compile 'org.apache.commons:commons-lang3:3.2.+'
    compile 'com.jakewharton:butterknife:6.0.0'
    compile 'com.afollestad:material-dialogs:0.7.7.0'
    compile 'it.neokree:MaterialTabs:0.11'
    compile 'com.github.johnkil.android-appmsg:appmsg:1.2.0'
    compile 'com.cocosw:bottomsheet:1.+@aar'
    compile 'de.psdev.licensesdialog:licensesdialog:1.7.0'
    compile 'com.afollestad:material-dialogs:0.7.7.0'
    compile 'joda-time:joda-time:2.7'

    compile 'com.google.android.gms:play-services:3.1+'
    compile project(':loadingLibrary')
    compile project(':welcomeLibrary')

//    compile project(':licenceDialogLibrary')
    compile project(':Bootstrap')
}

它曾经可以工作,然后我想添加一个新模块,然后一切都下降了。有没有人遇到过这个问题并解决了?我什至不知道出了什么问题..或者我是怎么做到的。

【问题讨论】:

  • 我知道您可能已经尝试过,但是您是否清理过项目和/或重新启动编译器?
  • 我试过了,没有运气,我无法编译我的项目,也不知道出了什么问题
  • 重复问题,这解决了问题:stackoverflow.com/questions/27806990/…
  • 刚重启 Studio,问题就解决了。

标签: android android-studio android-gradle-plugin


【解决方案1】:

解决这个问题的最简单方法是删除缓存。

对于 Windows,它位于 C:\Users\Administrator\.gradle\caches

对于 Mac OSX,它是 ~/.gradle/caches

尝试执行以下命令:

find ~/.gradle -type f -name "*.lock" | while read f; do rm $f; done

【讨论】:

  • 通过 Android Studio 文件中的选项使缓存无效 > 并重新启动对我来说不起作用,但是这样做了! +1
猜你喜欢
  • 2014-02-26
  • 2017-04-11
  • 2019-06-05
  • 2015-12-14
  • 1970-01-01
  • 1970-01-01
  • 2023-03-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多