【发布时间】:2020-02-02 01:41:10
【问题描述】:
我正在创建一个新的 Android 项目,详细信息如下:-
操作系统:MacBook Pro(13 英寸,2012 年中)和 mc OS mojave。版本 10.14.6, Android Studio 3.5 版
在尝试同步项目时,很少有文件被锁定并且同步失败。即使在删除它们并杀死 gradle 恶魔并再次启动同步之后,文件也会被锁定并且同步失败。
以下是错误的详细信息:-
' 错误:超时等待锁定构建输出清理缓存 (/Volumes/MYNEWVOLUME/study_material/android/ReadText/.gradle/buildOutputCleanup)。它是 当前由另一个 Gradle 实例使用。 所有者 PID:未知 我们的PID:8524 所有者操作:未知 我们的操作: 锁定文件: /Volumes/MYNEWVOLUME/study_material/android/ReadText/.gradle/buildOutputCleanup/buildOutputCleanup.lock
'
我发现当我开始同步时,两个 gradle 恶魔线程实例开始了。如果我尝试杀死其中任何一个,则同步失败。如果我让它运行,那么其中一个线程获取锁而其他线程无法获取锁,因此同步失败。
以下是 gradle 详细信息:-
'
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.readtext"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Gradle build details are
'
// Top-level build file where you can add configuration options common to all sub-
projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter ()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
【问题讨论】:
标签: android macos android-gradle-plugin