-2

I am facing issue with gradel for the liberary

implementation 'com.android.support:appcompat-v7:27.1.1'

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 25.2.0. Examples include com.android.support:animated-vector-drawable:27.1.1 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).

My gradle file contains following code.

My Android Studio is running on Android Studio 3.1

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "greetgalleryfree.binarycrust.com"
        minSdkVersion 18
        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.0.2'
    implementation 'com.google.firebase:firebase-database:11.8.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'
}

apply plugin: 'com.google.gms.google-services'
Paras Arora
  • 1,171
  • 2
  • 8
  • 16
  • From the IDE terminal type 'gradlew app:dependencies' and see where 25.2.0 is being pulled in. It's a long output so redirect to output file if needed. –  Apr 08 '18 at 19:42

1 Answers1

0

Add this to the very end of your build.gradle (Module:app):

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

   }
}

Make sure that you replace '27.1.1' with the version of the android support library that you want to use for all the dependencies , it should not be lower than your complile sdk version

than re sync gradle

Raman Sharma
  • 159
  • 1
  • 5