我在gradle配置中遇到问题,我收到此错误
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha1, 27.1.1, 27.0.2. Examples include `com.android.support:animated-vector-drawable:28.0.0-alpha1` and `com.android.support:cardview-v7:27.1.1`
https://image.ibb.co/gwJ16n/Untitled.png"错误"
如何解决此问题?
这是完整的buil.gradle配置。
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.sakan"
minSdkVersion 15
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.linger1216:labelview:v1.1.1'
implementation 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.easing:library:1.0.1@aar'
implementation 'com.daimajia.androidanimations:library:1.1.3@aar'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'
implementation group:'com.squareup.picasso', name:'picasso', version:'2.5.0'
implementation 'com.github.chenupt.android:springindicator:1.0.2@aar'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.txusballesteros:bubbles:1.2.1'
implementation 'com.romainpiel.shimmer:library:1.4.0@aar'
implementation 'tyrantgit:explosionfield:1.0.1'
implementation 'com.github.ksoichiro:android-observablescrollview:1.5.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.jakewharton:butterknife:7.0.1'
implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.github.darsh2:MultipleImageSelect:v0.0.4'
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-appindexing:15.0.0'
implementation 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2'
implementation 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'
}
我认为其中一个依赖项是使用不同的目标版本,我不知道如何解决这个问题。
答案 0 :(得分:2)
将它添加到build.gradle(Module:app)的最后:
configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
}
}
请务必更换' 27.1.1'对于要用于所有依赖项的android支持库的版本,它不应低于你的complile sdk版本
比重新同步gradle
我在here
中找到了这个答案答案 1 :(得分:1)
尝试在build.gradle中更改配置,如下所示
gradle.properties
它使forcefull更改为声明的版本,有时需要签名的apks
编辑1: 图像中显示的错误,不会打扰构建apk。
此处的错误是 aapt2 。 默认情况下,adle2是从gradle版本3.0+启用的,您需要通过将{{1}}添加到{{1}}文件来禁用它。
如果它不起作用,寻找aapt2错误的解决方案。
我已经运行了上面的build apk,通过强制支持版本,对我来说很好,虽然错误行没有消失
答案 2 :(得分:0)
将build.gradle更改为 - >依赖性{
实施'com.android.support:appcompat-v7:27.1.1'
实现'com.android.support.constraint:constraint-layout:1.1.0'
}