![](/img/trans.png)
[英]Failed to resolve com.android.support:support-compat:25.4.0
[英]Failed to resolve: com.android.support:support-compat:27.2.0
我的應用gradle中的依賴項存在問題:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "fr.android.MyApp"
minSdkVersion 16
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-compat:27.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
出現錯誤的行是:
implementation 'com.android.support:animated-vector-drawable:27.1.1'
它說:無法解決:com.android.support:animated-vector-drawable:27.1.1
和:
我還得到:配置'compile'已過時,並已由'implementation'和'api'代替。 它將在2018年底刪除。
這是我的build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
有關如何解決此問題的任何想法? 提前致謝。
這是因為您使用了舊版本的appcompat庫,即:
implementation 'com.android.support:appcompat-v7:25.1.1'
將其版本從v7:25.1.1更改為27.1.1
例:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-compat:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.2'
}
更改后同步項目
所有com.android.support必須使用完全相同的版本規范
您可以使用animated-vector-drawable:27.1.1
在版本27.1.1
和support-compat
的版本為27.2.0
。 您應該使它們具有相同的版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.