android studio error-混合版本会导致运行时崩溃

标签 android gradle dependencies

将“com.firebaseui:firebase-ui-auth:1.0.0”添加到依赖项后出现错误。当我从 gradle 中删除 'com.firebaseui:firebase-ui-auth:1.0.0' 时,错误消失了。代码和图片如下 请帮忙

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

最佳答案

这里存在错误!

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'

看到这个例子 包括 'com.android.support:animated-vector-drawable:25.3.0''com.android.support:mediarouter-v7:24.0.0'

只需将这些代码添加到依赖项中,确保版本相同。

只需更新 build.gradle 文件:-

compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'

关于android studio error-混合版本会导致运行时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42960731/

相关文章:

android - 如何解决在Android Studio中启动应用程序时出现的Android错误?

android - 如何使用代码进行联系人备份?

android - 在单个设备 android 上未收到 GCM 推送通知

Android:依次播放两种声音

java - hibernate + Maven + MySQL 连接器

java - 使用 Toothpick DI 框架与 Java(仅限)项目一起使用

gradle - 无法解析jOOQ生成的类TableOptions

Android数据绑定(bind)依赖与支持库冲突

C++ 组合,一个对象如何知道它所在的类?

java - 删除java项目中不必要的依赖项