Android version of Android version may cause runtime crashes
I am getting an error after adding 'com.firebaseui: firebase-ui-auth: 1.0.0' to the dependency. The error is removed when I remove "com.firebaseui: firebase-ui-auth: 1.0.0" from gradle. Code and pic are included below Help please
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.a.chatapp"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
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:25.3.0'
compile 'com.firebaseui:firebase-ui:0.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
source to share
The problem is that you are using two (or more) different versions of the same dependency. The first one is listed in your gradle file, and the other dependencies are used by the library you are using (in this case, firebase-ui, probably).
You have more options here. You should first try to update the firebase-ui dependency. They generally support updating support, so I assume they are using the same version of the support libraries as your current master branch (I think you are using the newest version com.android.support:appcompat, right?). If the latest version of firebase-auth does not use the current version of the support libraries, you can either downgrade your support version to match them, or you can create your own firebase-auth branch and keep it yourself.
source to share
There is a mistake here!
compile 'com.android.support:appcompat-v7:25.3.1'
All com.android.support libraries must use the same version specification (mixing versions may cause runtime crashes). Found versions 25.3.1, 25.3.0. Examples include "com.android.support:animated-vector-drawable:25.3.0" and "com.android.support:mediarouter-v7:24.0.0"
Seeing these examples include 'com.android.support:animated-vector-drawable:25.3.0'
and'com.android.support:mediarouter-v7:24.0.0'
Just add these codes as dependencies, make sure the versions are the same.
Just update the file build.gradle
like this: -
compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
source to share
Add these lines of code to your build.gradle (Module:app)
file at the end:
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'
}
}
}
}
You should change useVersion
from '25 .3.1 'to your current compilation / implementation SDK version.
Note:
If you are still using compile
in your build.gradle file, replace it with implementation
or api
as compilation support will officially end at the end of 2018.
For more information, you can contact:
Error: when replacing compilation with implementation in gradle (dependency)
What is the difference between implementation and compilation in gradle
source to share
well i read the comments, some of them are good but here is a simple solution for everyone, just follow the video
the mixed version can lead to runtime crashes
go to your gradle script -> build gradle (Module: app) and then add implementations as much as possible or as required.
Difficult to explain here, I'm just adding a link to keep it simple.
source to share