无法解决:leakcanary-android
升级到Grade后,我遇到了这个构建错误 .
我开始了一个全新的Android Studio项目并得到了同样的错误 . 其他人有同样的问题吗?
我在Android Studio 3.1上 . 以下是我全新项目的代码 .
build.gradle apply plugin:'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(顶级)buildscript {
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
我添加到这个新项目的唯一代码是follow,它在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'
这是泄漏中的错误吗?
2 回答
不太确定 . 它可能是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'