0

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?

1 Answers1

0

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.

Sushil Kadu
  • 314
  • 3
  • 7
  • thanks for the hint. this made my app work again. but the issue with {E/FirebaseApp: Firebase API initialization failure.} is still there – JohannesDey Dec 03 '18 at 15:22
  • can you paste snap of your project structure, are you missing google-services.json file – Sushil Kadu Dec 03 '18 at 16:45