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.
答案 0 :(得分:0)
有一个类似的问题here
我猜问题出在您使用的直接依赖项的传递依赖项中,因为在build.gradle文件中没有明确引用它们。其中一些使用一个版本(28.0.0),而另一些使用(26.1.10)。
上面引用的答案提供了一些解决方法。此外,根据您使用的Gradle版本(如果它是> = {4.6),您可以在自己的build.gradle文件中add constraints for those transitive dependencies以确保他们使用了您想要的版本。>