繁体   English   中英

Android App + Firebase初始化失败

[英]Android App + Firebase initializations fail

对于我的Android应用,我需要集成Firebase。 所以我遵循了谷歌教程。

现在我总是在实施firebase后得到

E/FirebaseApp: Firebase API initialization failure.

当我运行应用程序时(在真实设备和仿真上)

已经看到: Firebase数据库依赖项使应用程序崩溃,但他正在使用旧版本...

所以我的依赖关系如下所示:

   dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    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.android.gms:play-services-location:16.0.0'
    //implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.5'
}
apply plugin: 'com.google.gms.google-services'

这里的项目gradle:

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'



    }
}

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

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

有谁知道该怎么做才能消除这个初始化问题?

我认为,不要添加“ com.google.android.gms:play-services:”,而是确定playservices需要什么。 由于Play服务中塞满了22个程序包,因此您可能不会使用所有程序包。 这将使apk大小膨胀,并且您的项目中可能会越过65K个方法

我建议您通过此链接从playservices中选择所需的必要内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM