Firebase API initialization failure with using of Firebase notification - android

I am using of Firebase in my application and when I send a notification from Firebase my application will crash. And I added Firebase crash reporting in my application but in firebase console, I got nothing till now about any crashes in my application.
'com.google.firebase:firebase-crash:10.0.1'
This is my Gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "codenevisha.com.apps.bartarinapp"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//Image Slider
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'me.relex:circleindicator:1.2.2#aar'
//Google service GMS location
compile 'com.google.android.gms:play-services-location:11.0.4'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
//Circular Menu
compile 'com.github.Hitomis:CircleMenu:v1.1.0'
//Universal Image Loader
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//Lottie
compile 'com.airbnb.android:lottie:2.2.0'
//FireBase
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is my log cat when I get the crash:
codenevisha.com.apps.bartarinapp E/Trace: error opening trace file: No such file or directory (2)
codenevisha.com.apps.bartarinapp 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:511)
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:1058)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4819)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4432)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
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:1058) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:4819) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4432) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372) 
at android.app.ActivityThread.access$1300(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:5041) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.internal.zzapn
at com.google.android.gms.internal.zzbku.<clinit>(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
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:1058) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:4819) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4432) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372) 
at android.app.ActivityThread.access$1300(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:5041) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
at dalvik.system.NativeStart.main(Native Method) 
codenevisha.com.apps.bartarinapp E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.internal.zzbgz.zzf
codenevisha.com.apps.bartarinapp E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcjg.zzzq
codenevisha.com.apps.bartarinapp E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcjg.zzs
codenevisha.com.apps.bartarinapp E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
codenevisha.com.apps.bartarinapp E/FA: Discarding data. Failed to send app launch
codenevisha.com.apps.bartarinapp E/FA: Failed to get app instance id
codenevisha.com.apps.bartarinapp E/FA: Failed to send current screen to service
codenevisha.com.apps.bartarinapp E/FA: Discarding data. Failed to send event to service
codenevisha.com.apps.bartarinapp E/FA: Failed to send current screen to service
codenevisha.com.apps.bartarinapp E/FA: Discarding data. Failed to send event to service
codenevisha.com.apps.bartarinapp E/FA: Failed to send current screen to service
codenevisha.com.apps.bartarinapp E/FA: Discarding data. Failed to send event to service
codenevisha.com.apps.bartarinapp E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
java.lang.AbstractMethodError: abstract method not implemented
at com.google.firebase.iid.zzb.handleIntent(Unknown Source)
at com.google.firebase.iid.zzc.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
codenevisha.com.apps.bartarinapp E/FA: Failed to send current screen to service
codenevisha.com.apps.bartarinapp E/FA: Discarding data. Failed to send event to service

Related

Didn't used firebase in my project but still throws Firebase API initialization failure

I didn't used Firebase in my Android project, even didn't have any code related to Firebase but my app throws a fatal error like below. Please Guide.
Firebase API initialization failure
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
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:1750)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1719)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5229)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4803)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4743)
at android.app.ActivityThread.access$1500(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
Caused by: java.lang.IllegalArgumentException: Given String is empty or null
at com.google.android.gms.common.internal.zzac.zzhz(Unknown Source)
at com.google.android.gms.internal.zzagt$zza$zza.<init>(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.zzb(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.<init>(Unknown Source)
at com.google.android.gms.internal.zzahe.<init>(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.zzd(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.zzc(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
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:1750) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1719) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5229) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4803) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4743) 
at android.app.ActivityThread.access$1500(ActivityThread.java:169) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:194) 
at android.app.ActivityThread.main(ActivityThread.java:5546) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
Failed to initialize crash reporting
java.lang.RuntimeException: Missing an expected resource: 'R.string.google_api_key' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
at bmh.b(:com.google.android.gms.DynamiteModulesC:30)
at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl.init(:com.google.android.gms.DynamiteModulesC:70)
at bky.onTransact(:com.google.android.gms.DynamiteModulesC:60)
at android.os.Binder.transact(Binder.java:385)
at com.google.firebase.crash.internal.zzd$zza$zza.zza(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.<init>(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
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:1750)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1719)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5229)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4803)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4743)
at android.app.ActivityThread.access$1500(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
I really not want to import Firebase just to know FATAL errors got when code.
Dependencies:
dependencies {
compile project(':braintreePaymentLibrary')
compile 'com.google.android.gms:play-services:9.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.4.0'
// compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.thrivecom:ringcaptcha:1.0.8#aar'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/fastjson-1.1.33.android.jar')
compile 'com.github.clans:fab:1.6.3'
compile 'com.github.eluleci:flatui:3.0.0'
compile 'com.android.support:support-v4:23.+'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile('com.crashlytics.sdk.android:crashlytics:2.5.6#aar') {
transitive = true;
}
compile project(':mcalendarview')
compile 'me.everything:overscroll-decor-android:1.0.3'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpclient-4.3.6.jar')
compile 'com.facebook.android:facebook-android-sdk:4.+'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
}
This dependency includes ALL of the Play Services APIs, including Firebase:
compile 'com.google.android.gms:play-services:9.6.0'
Replace that dependency with the specific Play Services APIs you need. They are listed in Table 1 of the Play Services Setup Guide.

Why FirebaseUI logging assert A/FirebaseApp: Firebase API initialization failure eventhough I can run the application normaly?

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
}
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

Setting up Firebase in Android App

I am trying to integrate firebase in my android app. I have downloaded google-services.json file from firebase console, added classpath 'com.google.gms:google-services:3.0.0' in my project/build.gradle. I have also added apply plugin: 'com.google.gms.google-services' in my app/build.gradle. I am using google play services version 9.2.1. However, when I sync project files with gradle, I get following error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
If i change version of com.google.android.gms to 9.0.0, it sync successfully, however when I run my app, I get following error:
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:525)
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.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5097)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4680)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4613)
at android.app.ActivityThread.access$1300(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IncompatibleClassChangeError: android.support.v4.content.ContextCompat
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
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.zzbu(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1058) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5097) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4680) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4613) 
at android.app.ActivityThread.access$1300(ActivityThread.java:162) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:194) 
at android.app.ActivityThread.main(ActivityThread.java:5371) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
at dalvik.system.NativeStart.main(Native Method) 
Here are my dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.google.android.gms:play-services-maps:9.0.0'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:preference-v7:24.1.1'
compile 'com.android.support:preference-v14:24.1.1'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.mikhaellopez:circularimageview:3.0.2'
Can anyone guide me as to how can I use firebase along with google play services version 9.2.1????
Do you try to use
'com.google.firebase:firebase-auth:9.2.1'
with
'com.google.android.gms:play-services:9.2.1' ?
The 9.2.1 version of firebase can be uses as of July 14.
As per the Google Play services 9.0.1 release notes:
Fixes a class change compilation error with ContextCompat.getNoBackupFilesDir().
Update all of the Google Play services and Firebase dependencies to use version 9.0.1 or higher if you want to use version 24.0.0 or higher of the Android Support Library.

Google Play Services 9.2.1 and google-services plugin

My app needs to integrate google play services and firebase;so,I have downloaded the offical demo ,complie google play services and firebase sdk, google play services and firebase sdk have been updated to v9.2.1,the demo works well on android 5.0+,but crash on android 4.4.4.
Click here to download the demo!
Here is my build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.android.gms:play-services:9.2.1'
}
apply plugin: 'com.google.gms.google-services'
And here is the crash log:
07-19 14:34:29.790
25938-25938/com.google.firebase.quickstart.analytics
E/FirebaseCrash: Failed to initialize crash reporting
com.google.firebase.crash.internal.zzg$zza:
com.google.android.gms.internal.zzsj$zza: No acceptable module found.
Local version is 0 and remote version is 0.
at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.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.zzeh(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:5038)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4632)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566)
at android.app.ActivityThread.access$1500(ActivityThread.java:145)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5266)
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:826)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642)
at dalvik.system.NativeStart.main(Native Method)
Caused by: com.google.android.gms.internal.zzsj$zza: No acceptable
module found. Local version is 0 and remote version is 0.
at com.google.android.gms.internal.zzsj.zza(Unknown Source)
at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source) 
at com.google.firebase.crash.FirebaseCrash.(Unknown Source) 
at com.google.firebase.crash.FirebaseCrash.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.zzeh(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:5038) 
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4632) 
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566) 
at android.app.ActivityThread.access$1500(ActivityThread.java:145) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:145) 
at android.app.ActivityThread.main(ActivityThread.java:5266) 
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:826) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) 
at dalvik.system.NativeStart.main(Native Method)
Anyone can help me?
As a first step, you should identify the specific Play Service APIs your app needs and include only those instead of com.google.android.gms:play-services. Listing play-services as a dependency pulls in all of Play Services and causes the 64K limit on method references to be exceeded. This creates problems when running on pre-Lollipop devices.
The complete list of Play Services APIs is provided here and the Firebase APIs are listed here. Find the ones you need and list them in your dependencies instead of com.google.android.gms:play-services.
To get an understanding of all the libraries that are pulled in when you specify play-services as a dependency, you can look at this gist or open the Android Studio tool window for Gradle and run the androidDependencies task under :app\Tasks\android.
Firebase is now included in the google-play-services - see https://developers.google.com/android/guides/releases#june_2016_-_v92 . But somehow the play-services on API 19(aka Android 4.4) do not contain usable firebase-files. So what you have do do is, compile only the used APIs from the play-services and exclude the Firebase from them.
So remove line compile 'com.google.android.gms:play-services:9.2.1'
and replace with something like compile 'com.google.android.gms:play-services-NAME_OF_USED_API:9.2.1'
Alternative you could use an older Version of the google-play-services that doesn't contain Firebase.

New GCM Implemented, But Not starting App

Trying to implement GCM in my app. Compiled successfully. But when i run my app, Its crashing. Stack trace :
E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
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.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/sun.way2online.dropxapp-2/base.apk)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.(Unknown Source)
at com.google.firebase.iid.zzg.(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
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.zzbu(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at android.app.ActivityThread.installProvider(ActivityThread.java:5174) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709) 
at android.app.ActivityThread.-wrap1(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5443) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
07-05 12:01:28.476 15753-15753/sun.way2online.dropxapp D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
And
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.android.gms.iid.zzd' appears in /data/app/sun.way2online.dropxapp-2/base.apk)
at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
at com.google.android.gms.iid.zzd.(Unknown Source)
at com.google.android.gms.iid.zzd.(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at myapp.com.Services.RegistrationIntentService.onHandleIntent(RegistrationIntentService.java:29)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
My gradle file :
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
minSdkVersion 19
targetSdkVersion 24
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.android.support:appcompat-v7:24.0.0'
compile "com.google.android.gms:play-services-gcm:9.0.0"
}
apply plugin: 'com.google.gms.google-services'
The problem might comes from one of the libraries your app depends on, library that depends itself on Google Play Services as well. You might using an older version of the Google Play Services SDK and its still relies on the fact that Google API Client class is an interface. This breaks backward compatibility because of the transitive dependencies of libraries. Please check if you use the latest version or remove the dependecy if possible.
For more information regarding Google Play Services, check this link: https://www.reddit.com/r/androiddev/comments/3mehbb/breaking_changes_in_google_play_services_81/

Categories

Resources