添加Firebase会导致有关混合版本的警告,可能导致运行时崩溃

普尔基特

空项目上,添加Firebase后,将导致以下错误

图片版本:-

混合版本可能导致运行时崩溃

文字版本:-

所有com.android.support库都必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本27.1.1、25.2.0。示例包括com.android.support:animated-vector-drawable:27.1.1和com.android.support:support-media-compat:25.2.0

另一个错误:

警告:配置“编译”已过时,并已被“实现”和“ api”替换。

有什么可能的解决方案来消除这些警告?

我的项目build.gradle是:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我的应用程序build.gradle是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.mad.android.firebasetestauth2"
        minSdkVersion 24
        targetSdkVersion 27
        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:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:11.6.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

apply plugin: 'com.google.gms.google-services'
普尔基特

发生错误是因为google-services正在实现某些未使用27.1.1版本的库。因此,我们需要覆盖版本。

为了这样做,请始终尝试在android studio终端运行此命令

./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath

这将显示一个依赖项列表,其中显示了相关的版本号,如下所示:-

依赖项列表

在这里,我们需要找到那些未被覆盖的依赖项,其依赖项的版本号应为25或26,而不会被覆盖为27

像上面的例子一样 com.android.support:support-v4:25.2.0

现在,我们只需要使用最新的版本号将其添加到依赖项块中即可。

最后,依赖项块如下所示:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:support-media-compat:27.1.1'

    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:12.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

在这里我们添加

implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'

为了解决第二个错误

警告:配置“编译”已过时,并已被“实现”和“ api”替换。

project build.gradle中,更新

classpath 'com.google.gms:google-services:3.1.1'

classpath 'com.google.gms:google-services:3.2.0'

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Firebase:混合版本可能导致运行时崩溃

混合版本可能导致运行时崩溃

Android Studio 3.2.1:连接Firebase时,混合版本可能导致运行时崩溃

所有gms / firebase库必须使用完全相同的版本(混合版本可能导致运行时崩溃)。找到的版本16.1.1 16.0.1 16.0.0 15.0.1

Android Gradle:所有gms / firebase库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)

Android Studio错误混合版本可能导致运行时崩溃

混合版本可能导致运行时崩溃。帮助找到原因

由于“混合版本可能导致运行时崩溃”,因此运行应用程序时Android AVD崩溃

所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)

删除注释会导致运行时崩溃吗?

所有 com.android.support 库必须使用完全相同的版本规范(混合版本会导致运行时崩溃)

警告变量“csCryptoStream”在被赋值之前被使用。运行时可能会导致空引用异常

在运行时使用'realloc()'会导致崩溃,为什么?-C语言

从Go 1.13升级后,使用Go 1.14进行构建时,是什么导致此运行时内部错误有关“先前声明于”的信息?

将值添加到DataPoint数组中导致运行时应用程序崩溃

从x到y的协变量数组转换可能会导致运行时异常

变量 'loginusername' 在被赋值之前使用。运行时可能会导致空引用异常

通过添加值更改字符串中的字符会导致运行时错误

具有移动语义的C ++可变参数工厂导致运行时崩溃

有关调试Vue运行时错误的提示

使用Material Button会导致ClassNotFound运行时错误

循环中的Getpivotdata会导致运行时错误1004

调用Device.RuntimePlatform会导致运行时异常

插入公式会导致运行时错误1004

删除表控件会导致运行时错误

如何在运行时查找有关已加载的d3.js扩展及其版本的信息?

Firebase依赖项在运行时导致错误

Firebase运行时崩溃

通过StructureMap定义'HttpClient'单例会导致有关在运行时未配置'HttpMessageHandler'的错误