无法解决:泄漏金丝雀-安卓
升级到 4.4 年级后,我遇到了这个构建错误。
我启动了一个全新的Android Studio项目,但遇到了同样的错误。还有其他人有同样的问题吗?
我使用的是安卓工作室3.1。以下是我的全新项目的代码。
build.gradle应用插件:"com.android.application">
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.xi_zz.myapplication"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
}
build.gradle (顶级( 构建脚本 {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.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
}
gradle-wrapper.properites
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
我添加到这个新项目的唯一代码是以下内容,这是 https://github.com/square/leakcanary 中说明的。
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
这是泄漏金丝雀中的错误吗?
确定。这可能是 Gradle 4.4 的问题,因为我在更新到 Gradle 4.5 后解决了它。
问题是空格
试试这个
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'