android studio error- mixing versions can lead to

2019-04-10 11:03发布

I get an error after adding 'com.firebaseui:firebase-ui-auth:1.0.0' to the dependency. The error goes away when I delete 'com.firebaseui:firebase-ui-auth:1.0.0' from the gradle. Code and pic 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'

enter image description here

6条回答
家丑人穷心不美
2楼-- · 2019-04-10 11:23

putting

//noinspection GradleCompatible

Solved my issue

查看更多
▲ chillily
3楼-- · 2019-04-10 11:24

Here exist an error!

compile 'com.android.support:appcompat-v7:25.3.1'

All com.android.support libraries must use the exact same version specification (mixing versions can lead to 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 this Examples include 'com.android.support:animated-vector-drawable:25.3.0' and 'com.android.support:mediarouter-v7:24.0.0'

Just add these codes in dependencies, make sure that versions are same.

Just update build.gradle file with this :-

compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
查看更多
迷人小祖宗
4楼-- · 2019-04-10 11:32

What you need to do is check the which library dependency version is conflicting you can track that library with Run androidDependancies like: AndroidDependacies Report
and then find that conflicting dependency and add those dependencies with updated versions in your gradle file.

查看更多
5楼-- · 2019-04-10 11:35

The problem is that you use two (or more) different versions of the same dependency. The first one is specified in your gradle file and the other dependencies are used by library which you use (in this case firebase-ui probably).

You have more options here. At first you should try to update firebase-ui dependency. They usually keep their support dependecies updated so I guess that they use the same version of support libraries as you in their current master branch (I guess that you use the newest 'com.android.support:appcompat' version, right?). If the last version of firebase-auth doesn't use the current version of support libraries you can either downgrade your support libraries version so it will match their either you can create your own fork of firebase-auth and keep it updated on your own.

查看更多
We Are One
6楼-- · 2019-04-10 11:43

Add these lines of code in your build.gradle (Module:app) file at 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 must change useVersion from '25.3.1' to your current compile/implementation SDK version.

NOTE:

If you are still using compile in your build.gradle file then replace it with implementation or api because compile support will be ended officially at the end of 2018.

For more details you may refer:

Error: when I replace compile with implementation in gradle(dependency)

What's the difference between implementation and compile in gradle

查看更多
Ridiculous、
7楼-- · 2019-04-10 11:48

well I have read comments some of them are good but Here is the simple solution for all just follow the video

mixing version can lead to runtime crashes

go to your gradle script -->build gradle(Module:app) and then add the implementaions as many as you can or according to requirement.

Difficult to explain here I just add the link so that for ease.

查看更多
登录 后发表回答