Mixing versions can lead Runtime crashes

Asked

Viewed 554 times

0

I’m having a problem with com.android.support:appcompat-v7:26.1.0. Anddroidstudio says that:

All com.android.support Libraries must use the Exact same version Specification (Mixing versions can lead to Runtime crashes). Found versions 27.1.0, 26.1.0. Examples include com.android.support:Animated-vector-drawable:27.1.0 and com.android.support:design:26.1.0

Then I tried to explain the com.android.support:animated-vector-drawable:26.1.0, but it didn’t work. Anyway, this is my Gradle:

 apply plugin: 'com.android.application'

 android {
     compileSdkVersion 26
     buildToolsVersion '26.0.2'
     defaultConfig {
         applicationId "******"
         minSdkVersion 16
         targetSdkVersion 26
         versionCode 1
         versionName "1.0"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
         vectorDrawables.useSupportLibrary = true
         multiDexEnabled true
     }

     buildTypes {
         release {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
         }
     }
 }

 dependencies {
     implementation 'com.google.android.gms:play-services-maps:11.8.0'
     implementation 'com.github.bumptech.glide:glide:4.5.0'
     annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0'
     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:26.1.0'
     compile 'com.android.support:animated-vector-drawable:26.1.0'
     compile 'com.android.support:support-v4:26.1.0'
     compile 'com.android.support.constraint:constraint-layout:1.0.2'
     compile 'com.android.support:support-v4:26.1.0'
     compile 'com.android.support:design:26.1.0'
     compile 'de.hdodenhof:circleimageview:2.0.0'
     compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
     compile 'com.android.support:design:26.1.0'

     //Firebase
     compile 'com.google.firebase:firebase-auth:11.8.0'
     compile 'com.google.firebase:firebase-core:11.8.0'
     compile 'com.google.firebase:firebase-messaging:11.8.0'
     compile 'com.google.firebase:firebase-database:11.8.0'
     compile 'com.google.firebase:firebase-storage:11.8.0'
     compile 'com.google.firebase:firebase-ads:11.8.0'

     //Google services
     compile 'com.google.android.gms:play-services-places:11.8.0'
     compile 'com.google.android.gms:play-services-location:11.8.0'
     compile 'com.google.maps.android:android-maps-utils:0.4+'
     compile 'com.google.android.gms:play-services-maps:11.8.0'


     testCompile 'junit:junit:4.12'
 }

 apply plugin: 'com.google.gms.google-services'

I also don’t know how I should change targetSdkVersion or compileSdkVersion to the 27, open to this too =)

Ah, and when I try to run the project I have the following erro::app:transformClassesWithMultidexlistForDebug. I hope this can help

  • I resolved to change all compiles to implementation and to "27.0.1", compileSdkVersion and targetSdkVersion to 27 and buildToolsVersion to 27.0.3

1 answer

0

Add this code at the end of build.Radle (Module:app).

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion '27.1.1'
        }
    }
}

}

And exchange all the compile for implementation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.