我遇到了一个奇怪的问题。我想将我的 Gradle 从版本 2.14.1
升级到 5.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)
我正在查看一些旧帖子,它们都详细说明了项目所需的内容,但奇怪的是,上面是空白的。
这是我的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()
}
}
我还双重检查了在Android Studio > 属性 > Gradle > 使用本地Gradle发行版
中的gradle路径,我已将其设置为根目录下的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)
What am I doing wrong?
EDIT: 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}"
}
android.useAndroidX=true
和android.enableJetifier=true
。 - Dalmas