I am receiving the following error message in my build.gradle file:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 25.2.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:25.2.0 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
Below is the current state of my build.gradle file. I can't see any explicit reference to the dependencies of differing versions mentioned in the above error message however.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.parse.ideanetwork"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 5
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:28'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:28.0.0'
compile 'com.google.android.gms:play-services-ads:11.0.0'
compile "com.github.parse-community.Parse-SDK-Android:parse:1.18.5"
}
Any help is much appreciated. Thanks.
Explicitly declare the oldest version dependences with the latest version seems to work. I don't think it's the better solution (maybe it is not a solucion at all), but it dismiss the warning. It is what am I doing and nothing breaked untill now.
Use this, it will fix the dependency version incompatibility problem.
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
// Skip multidex because it follows a different versioning pattern.
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.