我原本想将gradle移动到新目录:/ Volumes / FLASHMEMORY / Android / Gradle
但是,由于我昨天从原始系统的原始目录中删除了gradle文件夹并在Android Studio中重新指定了目录,因此无法编译所有项目,无论是新项目还是原始项目。
我总是遇到如下错误信息:
Gradle sync failed: Timeout waiting to lock cp_init remapped class cache for a2hfc9tvdzsey2shpvt2yk7sb (/Volumes/FLASHMEMORY/Android/Gradle/caches/3.3/scripts-remapped/asLocalRepo_2l9w7fvtmyueda6rnni9t3t84/a2hfc9tvdzsey2shpvt2yk7sb/cp_init1efd45104ffa2d33563b85b9edda76e3) It is currently in use by another Gradle instance..
Owner PID: unknown
Our PID: 3461
Owner Operation: unknown
Our operation:
Lock file: /Volumes/FLASHMEMORY/Android/Gradle/caches/3.3/scripts-remapped/asLocalRepo_2l9w7fvtmyueda6rnni9t3t84/a2hfc9tvdzsey2shpvt2yk7sb/cp_init1efd45104ffa2d33563b85b9edda76e5/tow_init1efd45104ffa2d33563b85b9edda76e3.lock
Consult IDE log for more details (Help | Show Log)
我的Android Studio设置:
Project-level settings: Use default gradle wrapper (recommended)
Global Gradle settings-> Service directory path: / Volumes / FLASHMEMORY / Android / Gradle
项目根目录中的build.gradle文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module目录中的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.cnblogs.guqiangjs.myapplication"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
Gradle-wrapper.properties文件内容:
DistributionBase = GRADLE_USER_HOME
DistributionPath = wrapper / dists
ZipStoreBase = GRADLE_USER_HOME
ZipStorePath = wrapper / dists
DistributionUrl = https \: //services.gradle.org/distributions/gradle-3.3-all.zip
我试过了:
删除锁定的文件。
清空整个/ Volumes / FLASHMEMORY / Android / Gradle文件夹。
重新安装Android Stuido。
但上述尝试以失败告终......
还请帮忙!谢谢!
答案 0 :(得分:0)
糟糕!今天我尝试将Gradle目录更改回计算机的磁盘,问题解决了!
我只修改了一个内容:
Android Stuido -> Global Gradle settings -> Service directory path: /Users/MyUserName/Documents/Gradle