0

I want to ask about why FirebaseUI logging the assert A/FirebaseApp: Firebase API initialization failure eventhough I can run the app normaly?

in my dependency, I only use compile: 'com.firebaseui:firebase-ui:0.6.2' and nothing else.

I used GridView and RecyclerView each in 2 different Activities using the FirebaseListAdapter and FirebaseRecyclerAdapter.

But, there is always this assert in my android monitor:

10-29 23:38:44.099 25919-25919/com.xenolang.xenolang A/FirebaseApp: Firebase API initialization failure.
                                                                    java.lang.reflect.InvocationTargetException
                                                                        at java.lang.reflect.Method.invokeNative(Native Method)
                                                                        at java.lang.reflect.Method.invoke(Method.java:515)
                                                                        at com.google.firebase.FirebaseApp.zza(Unknown Source)
                                                                        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                        at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                                                                        at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
                                                                        at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
                                                                        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                                        at android.app.ActivityThread.installProvider(ActivityThread.java:5026)
                                                                        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4621)
                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4561)
                                                                        at android.app.ActivityThread.access$1500(ActivityThread.java:139)
                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)
                                                                        at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                        at android.os.Looper.loop(Looper.java:149)
                                                                        at android.app.ActivityThread.main(ActivityThread.java:5257)
                                                                        at java.lang.reflect.Method.invokeNative(Native Method)
                                                                        at java.lang.reflect.Method.invoke(Method.java:515)
                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                                                                        at dalvik.system.NativeStart.main(Native Method)
                                                                     Caused by: java.lang.NoSuchMethodError: com.google.android.gms.common.internal.zzaa.zzz
                                                                        at com.google.android.gms.measurement.internal.zzx.zzbd(Unknown Source)
                                                                        at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
                                                                        at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                        at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                        at com.google.firebase.FirebaseApp.zza(Unknown Source) 
                                                                        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                                                                        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                                                                        at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
                                                                        at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
                                                                        at android.content.ContentProvider.attachInfo(ContentProvider.java:1591) 
                                                                        at android.content.ContentProvider.attachInfo(ContentProvider.java:1562) 
                                                                        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
                                                                        at android.app.ActivityThread.installProvider(ActivityThread.java:5026) 
                                                                        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4621) 
                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4561) 
                                                                        at android.app.ActivityThread.access$1500(ActivityThread.java:139) 
                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) 
                                                                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                        at android.os.Looper.loop(Looper.java:149) 
                                                                        at android.app.ActivityThread.main(ActivityThread.java:5257) 
                                                                        at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                        at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                                                                        at dalvik.system.NativeStart.main(Native Method)

I/FirebaseInitProvider: FirebaseApp initialization successful

Regards,

EDIT

build.gradle (Module: app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"

    defaultConfig {
        applicationId "com.application.id"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.firebaseui:firebase-ui:0.6.2'
}

apply plugin: 'com.google.gms.google-services'

build.gradle (Project: Application)

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
j.elmer
  • 1,441
  • 2
  • 17
  • 36
  • 1
    The same call stack was posted in this question:http://stackoverflow.com/q/37396973/4815718. Try looking at some of the answers there. The question is old, but might gives you some clues. – Bob Snyder Oct 29 '16 at 20:28
  • I already look at that answer before and it didn't work, maybe because the other question only using firebase while I use firebaseUI which already has the needed dependencies and I only need to one dependency of firebaseUI and didn't use anything. And while he got an error, I only got an assertion. – j.elmer Oct 30 '16 at 12:00
  • Post your build.gradle files. – Bob Snyder Oct 30 '16 at 14:08
  • sorry for the inconvenience, I already add the `build.gradle` files. thank you for your response – j.elmer Oct 30 '16 at 14:22

1 Answers1

0

The device or emulator you are using has an old version of Google Play Services. FirebaseUI 0.6.2 uses version 9.8.0 of the Firebase APIs. They require the latest version of Google Play Services, which is 9.8.77.

Your logcat output probably contains a warning similar to this:

W/GooglePlayServicesUtil: Google Play services out of date.  Requires 9877000 but found 9875480
Bob Snyder
  • 37,759
  • 6
  • 111
  • 158