我的App中的依赖项有一个问题:
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
以及:

我还得到:配置‘编译’已经过时,并已被替换为‘实现’和'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
}知道怎么解决这个问题吗?提前谢谢。
发布于 2018-05-07 15:00:31
这是因为您使用了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'
}更改后同步项目
发布于 2018-05-07 15:00:17
所有com.android.support必须使用完全相同的版本规范。
animated-vector-drawable:27.1.1在27.1.1版本中使用,support-compat在27.2.0版本中使用。你应该做同样的版本。
https://stackoverflow.com/questions/50216846
复制相似问题