3

I am creating an app that uses firebase authentication for login and registration but I keep getting sudden crashes as soon as I run the application. I'm getting a warning in my Gradle.build file at the app level. The warning says

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0

I've tried changing com.android.support:appcompat-v7:28.0.0 to v7:26.0.1 and 27.1.0 but none of them solved the problem.

My build.gradle file is as follows:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.project.tck.rescueme_responder"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
}
apply plugin: 'com.google.gms.google-services'

I expect a login that authenticates using FireBase when I run the application but then the application crashes each time I run it.

halfer
  • 19,824
  • 17
  • 99
  • 186
tck
  • 61
  • 5
  • did you tried to match the version numbers of firebase dependencies? example: implementation 'com.google.firebase:firebase-core:16.1.0' implementation 'com.google.firebase:firebase-auth:16.1.0' – Chris Vera Jan 20 '19 at 23:25
  • No I haven't, sadly my laptop was stolen today so I have to restart the project on another machine. But I'll give that a shot. Thanks for the contribution. – tck Jan 21 '19 at 16:57

1 Answers1

0

There is a similar question here
I guess the problem is in the transitive dependencies of the direct dependencies you use since I don't see them explicitly referenced in your build.gradle file. Some of them use one version (28.0.0) while some another (26.1.10).
The above referenced answer provides some workarounds. Furthermore, depending on the Gradle version you use (if it is >=4.6), you may be able to add constraints for those transitive dependencies in your build.gradle file to be sure they use the version you want.

tryman
  • 3,233
  • 1
  • 12
  • 23
  • I've gone through the similar question and it shed more light to me. Unfortunately, my laptop got stolen so I have to restart the project. Thank you very much for your response. – tck Jan 21 '19 at 17:00
  • Really?! That's unfortunate my friend. All the best of luck rebuilding. – tryman Jan 21 '19 at 18:24