Mixing versions can lead runtime crashes

0

I'm having a problem with com.android.support:appcompat-v7:26.1.0 . AnddroidStudio says:

  

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 explicit the com.android.support:animated-vector-drawable:26.1.0 , but it did not 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 do not know how or if I should change the targetSdkVersion or compileSdkVersion to 27, open for this too =)

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

    
asked by anonymous 01.03.2018 / 02:48

1 answer

0

Add this code at the end of build.grad (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 change all compile to implementation .

    
17.04.2018 / 15:40