Android Studio 缓存它当前正由另一个Gradle示例使用

fumotvh3  于 12个月前  发布在  Android
关注(0)|答案(2)|浏览(171)

我不明白为什么会这样。

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)

字符串
grad尔将军是:

// 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"
    }
}


App 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')
}


它曾经工作,然后我想添加一个新的模块,它都走下坡路后,有人有这个问题,并解决了它?我甚至不知道是什么错了..或我如何使这一点。

n6lpvg4x

n6lpvg4x1#

解决这个问题最简单的方法是删除缓存。
对于Windows,它在C:\Users\Administrator\.gradle\caches
对于Mac OSX是~/.gradle/caches
尝试执行以下命令:

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

字符串

ltqd579y

ltqd579y2#

解决方案:
1)停止Gradle守护程序:

在项目的根目录中运行以下命令,尝试停止Gradle守护程序:

./gradlew --stop

字符串
这将停止与您的项目关联的任何正在运行的Gradle守护程序。

2)清理Gradle缓存:

通过运行以下命令清理Gradle缓存:

./gradlew clean


这个命令将清理你的项目,并删除所有潜在的锁。

3)手动删除Gradle缓存:

手动删除项目根目录中的.gradle目录。这将强制Gradle再次下载依赖项并重新创建该高速缓存。

rm -rf .gradle

4)检查运行进程:

检查是否有其他进程正在使用Gradle缓存。在基于Unix的系统上,您可以使用lsof命令查看哪些进程正在使用特定的文件或目录:

lsof | grep .gradle


这将显示当前是否有任何进程正在使用Gradle缓存。

5)重启IDE

相关问题