Gradle构建错误(找不到tracker.jar)

时间:2018-05-28 10:51:32

标签: android build.gradle

找不到tracker.jar(com.android.tools.analytics-library:tracker:26.1.2)。 在以下位置搜索:     https://jcenter.bintray.com/com/android/tools/analytics-library/tracker/26.1.2/tracker-26.1.2.jar

2 个答案:

答案 0 :(得分:1)

我已修复此错误 请更新您的build.gradle项目文件,如下所示:

    buildscript {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'
        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://jitpack.io" }
    }
}

将jcenter()放在google()下面。这有助于我在搜索Jar文件后浪费时间24小时。

答案 1 :(得分:0)

我通过在build.gradle中添加'mavenCentral'解决了该错误

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}