简体   繁体   中英

Android App + Firebase initializations fail

for my Android App, I need firebase integrated. So I followed the google tutorial.

now I am always getting after implementing firebase

E/FirebaseApp: Firebase API initialization failure.

when I run the App (on Real Device and Simulation)

Already saw that: Firebase database dependency crashes app but he is working with old versions...

So my dependencies look like this:

   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'

here the projects 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
}

does anybody know what to do to get rid of this initalization problem?

I think, instead of adding "com.google.android.gms:play-services:", identify what is needed from playservices. Because play services is stuffed with 22 packages and you might not using all of it. This will bloat the apk size and you might cross 65K methods in your project.

I'd advice, you go through this link and pick necessary things you need from playservices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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