我在sdk兼容性方面一直有错误。这是我的代码
https://google.com
我在实现'com.android.support:appcompat-v7:27.1.1'时遇到错误。建议示例包括com.android.support:animated-vector-drawable:27.1.1和com.android.support:support-v4:26.1.0
这是我的构建gradle项目
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.capstone.katugna"
minSdkVersion 23
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'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
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'
答案 0 :(得分:2)
由于多个传递依赖项而导致的版本冲突是从不同的api / lib中提取的,您可能需要在模块gradle中强制将解析策略设置为
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}
此外,在gradle中明确提到的依赖项为
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-compat:27.1.1'
答案 1 :(得分:0)
我遇到了同样的问题,我不得不将接下来的2个库添加到Gradle中的依赖项中。我不知道它为什么起作用,但是它起作用。
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'