【问题标题】:Android Studio 3.2.1: mixing versions can lead to runtime crashes when connect firebaseAndroid Studio 3.2.1:连接firebase时混合版本可能导致运行时崩溃
【发布时间】:2018-12-13 16:41:05
【问题描述】:

这是错误 *** 所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0、26.1.0。示例包括 com.android.support:animated-vector-drawable:28.0.0 和 com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) 有一些库或工具和库的组合是不兼容的,或者可能导致错误。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本进行编译(或者特别是低于您的 targetSdkVersion 的版本)。

这是关于 gradle 依赖的错误行 = implementation 'com.android.support:appcompat-v7:28.0.0'

这是我的 gradle(应用程序) enter image description here

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.thiyo.sdddddddddddddddddddd"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.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.1'
}
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 请添加您的 build.gradle 文件的内容和整个错误消息。
  • um new to stack 有提及错误

标签: android firebase gradle connect


【解决方案1】:

感谢所有帮助我找到答案:-)

为了解决我刚刚添加了这些行 gradle 依赖块

喜欢这个

>

implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

【讨论】:

    【解决方案2】:

    将以下代码添加到 gradlebuild 项目而不是 gradle app 中,它会解决您的问题,将其添加到最后。

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "26.1.0"
                }
            }
        }
    }
    

    【讨论】:

    • 答案中的一点解释将有助于其他人理解确切的解决方案
    • 此代码将使用以前的实现依赖项,如果当前版本出错,则不会混合库
    【解决方案3】:

    从菜单File-> Invalidate Caches and Restart -> Invalidate and Restart试试这个

    如果这不起作用,删除.idea文件(从项目的根目录),Build -> Clean Project然后Build -> Rebuild Project

    【讨论】:

      【解决方案4】:

      尝试同时使用 appcompat 和支持,然后添加其他实现

      implementation 'com.android.support:appcompat-v7:28.0.0'
      implementation 'com.android.support:support-v4:28.0.0'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-08-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-06-27
        • 1970-01-01
        相关资源
        最近更新 更多