android - 生成错误:更新到Gradle 4.4后 `Failed to resolve: leakcanary-android`

标签 android gradle leakcanary

Failed to resolve: leakcanary-android



升级到4.4级后,出现此构建错误。

我启动了一个全新的Android Studio项目,并遇到了相同的错误。还有其他人有同样的问题吗?

我在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(顶层)
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

以下是我添加到此新项目中的唯一代码,该代码在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后解决了它。

关于android - 生成错误:更新到Gradle 4.4后 `Failed to resolve: leakcanary-android`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49739851/

相关文章:

java - 使用 gradle 任务在 jar 中设置变量值

android - Navigation Arch 组件会造成误报内存泄漏吗?

android - 我应该为发布版本删除泄漏的金丝雀代码/类吗?

java - 如何理解显示LeakCanary?

android - GROUP BY 与 CursorLoader

android - 从 App Store 和 Google Play 将每个移动应用程序下载到 Mac 或 PC 的最快/最简单方法是什么?

android - react native 相机 Gradle 同步失败 : Could not find method google() for arguments [] on repository container

android - 如何增加 Android Studio (MacOS High Sierra) 中的字体大小?

android-studio - gradle.properties 中的条件代理设置

gradle - 为什么 gradle clean task 启动所有其他非默认任务?