0

I'm trying to use Firebase on Android Studio. I have a problem in my grade file. I've got the following message on line

androidTestImplementation 'com.android.support.test:runner:1.0.1

All com.android.support librairies must use the same version specification. Found versions 27.1.0, 26.1.0

This is My Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "fr.ilandes.inarttransport"
        minSdkVersion 21
        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(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    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:appcompat-v7:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'pub.devrel:easypermissions:1.1.3'

    compile 'com.google.firebase:firebase-core:12.0.1'
}


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

The error disappear when I remove lines concerning Firebase

...
  compile 'com.google.firebase:firebase-core:12.0.1'
}
apply plugin: 'com.google.gms.google-services'

Firebase is the source of the conflict but how to fix that?

Sébastien REMY
  • 2,399
  • 21
  • 39

3 Answers3

0

Try excluding it

compile ('com.google.firebase:firebase-core:12.0.1') {
    exclude group: 'com.android.support'
}
pradithya aria
  • 657
  • 5
  • 10
0

Use ./gradlew app:dependencies to find the dependency tree and see which dependency is using the old version. Then check if this dependency itself has a new version.

Sir Codesalot
  • 7,045
  • 2
  • 50
  • 56
0

I had those lines of code at the end of my gradle file. It's removing the error but I don"t know if Firebase works fine, I need more tests...

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.0'
            }
        }

    }
}
Sébastien REMY
  • 2,399
  • 21
  • 39