Gradle 同步失败:找不到 com.android.tools.build:gradle:5.5.1

Eur*_*e01 6 android gradle

所以,我遇到了一个奇怪的问题。我想将我的 gradle 从版本升级2.14.15.5.1它,它不会让我。

这是我得到的错误:

Gradle sync failed: Could not find com.android.tools.build:gradle:5.5.1.
            Searched in the following locations:
            - https://jcenter.bintray.com/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.pom
            - https://jcenter.bintray.com/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.jar
            Required by:
            project :
            Consult IDE log for more details (Help | Show Log) (1 s 664 ms)
Run Code Online (Sandbox Code Playgroud)

我正在浏览一些较旧的帖子,它们都详细说明了项目和项目的要求,但奇怪的是,上面是空白的。

这是我的build.gradle文件的样子:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:5.5.1'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

我还仔细检查了 gradle 路径,Android Studio > Properties > Gradle > Use local Gradle distribution并将其设置为根gradle-5.5.1目录。

日志也没有帮助,它说的和上面一样:

2019-07-14 08:28:28,670 [thread 268]   INFO - e.project.sync.GradleSyncState - Gradle sync failed: Could not find com.android.tools.build:gradle:5.5.1.
Searched in the following locations:
  - https://jcenter.bintray.com/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.pom
  - https://jcenter.bintray.com/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.jar
Required by:
    project :

Consult IDE log for more details (Help | Show Log) (5 s 536 ms) 
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

编辑: App > build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'


    signingConfigs {
        liveConfig
                {
                   //removed due to privacy 
                }

        devConfig
                {
                 //removed due to privacy
                }

    }


    defaultConfig {
        applicationId "com.company.name"
        minSdkVersion 19
        targetSdkVersion 28
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
            signingConfig signingConfigs.liveConfig
            buildConfigField "boolean", "IS_SERVICES_LIVE", "true"
            //no app created for flurry live tagging
            buildConfigField "boolean", "IS_FLURRY_LIVE", "true"
            buildConfigField "boolean", "IS_FLURRY_QA", "false"
            buildConfigField "String", "BASE_URL", "\"http://media.company.com/WebServices/prod/mobileapps/cc/data/\""

        }

        debug {
            signingConfig signingConfigs.devConfig
            buildConfigField "boolean", "IS_SERVICES_LIVE", "true"
            //no app created for flurry live tagging
            buildConfigField "boolean", "IS_FLURRY_LIVE", "false"
            buildConfigField "boolean", "IS_FLURRY_QA", "false"
            buildConfigField "String", "BASE_URL", "\"http://media.company.com/WebServices/prod/mobileapps/cc/data/\""

        }

    }
    aaptOptions {
        cruncherEnabled = false
    }
    dataBinding{
        enabled true;
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation 'com.android.support:support-v4:28.0.0'

    implementation files('libs/android-binding-v0.6-preview.jar')
    implementation 'com.flurry.android:analytics:8.2.0@aar'
    implementation files('libs/ormlite-android-5.0.jar')
    implementation files('libs/ormlite-core-5.0.jar')
    implementation 'com.google.android.gms:play-services-vision:18.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'

    implementation 'io.reactivex:rxjava:1.1.5'
    implementation 'io.reactivex:rxandroid:1.1.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.github.bumptech.glide:glide:4.0.0'

    def appCenterSdkVersion = '2.0.0'
    implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
    implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"

}
Run Code Online (Sandbox Code Playgroud)

Dal*_*mas 10

This dependency corresponds to the Android gradle plugin, not Gradle itself. Typically, the Android gradle plugin should match the version number of your Android Studio installation (e.g. "3.4.2").

如果您想更新 Gradle 本身,并且您正在使用 gradle 包装器,请更新gradle/wrapper/gradle-wrapper.properties文件并编辑该distributionUrl行:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
Run Code Online (Sandbox Code Playgroud)

如果您使用的是本地发行版,那么您无需执行任何操作。您的项目将使用在 Android Studio 设置中设置的 gradle 发行版(在您的情况下为 Gradle 5.5.1)构建。

编辑:似乎您的 build.gradle 文件也缺少google()存储库,如果您想使用 Android gradle 插件 3.4.2,它应该是什么样子:

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)