java.lang.IncompatibleClassChangeError in gcm push notification - android

Previously, GCM was working fine but after updating Google Play Services it stopped working. I am encountered with the following logcat error:
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Con‌​text)' 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/com.notnul.notnul-1/base.apk) at com.notnul.notnul.RegistrationIntentService.onHandleIntent(RegistrationIntentSer‌​vice.java:53)
And here is my code where logcat is pointing:
instanceID = InstanceID.getInstance(this);
GCM_Token = InstanceID.getInstance(getApplicationContext()).getToken(authorizedEntity, scope);
GCM_InstaceID = instanceID.getInstance(getApplicationContext()).getId();
I am unable to find the error. Can anyone help me regarding this? Thanks in advance!

Update to Google Play services library version 9.0.2.
https://developers.google.com/android/guides/releases says:
Google Play services updated to 9.0.1
The Google Play services version 9.0.1 release is now available. This release fixes the following issues with the version 9.0.0 release:
Fixes a class change compilation error with ContextCompat.getNoBackupFilesDir().

Related

Don't get subscription plan using in_app_purchase dependency flutter

enter image description here
in_app_purchase throw error [purchaseId] not found so what I do?
I am using in_app_purchase: ^3.1.1
I get all the producers from the play console but not the subscriptions.
I try both of purchasePlanId and basePlanId but get same error [id]not found

java.lang.SecurityException: Unknown calling package name, com.google.android.gms.common.internal.zzs

I got many crashes from my app which include GCM(Google Notification) feature.
The crash detail as below:
java.lang.SecurityException: Unknown calling package
name'com.mypackagename'.-android.os.Parcel.readException(1465)
android.os.Parcel.readException(1419)
com.google.android.gms.common.internal.zzs$zza$zza.zza(-1)
com.google.android.gms.common.internal.zzs$zza$zza.zza(-1)
com.google.android.gms.common.internal.zzj.zza(-1)
com.google.android.gms.common.internal.zzj$zzf.zza(-1)
com.google.android.gms.common.internal.zzj$zzh.zzqL(-1)
com.google.android.gms.common.internal.zzj$zza.zzc(-1)
com.google.android.gms.common.internal.zzj$zza.zzw(-1)
com.google.android.gms.common.internal.zzj$zzc.zzqN(-1)
com.google.android.gms.common.internal.zzj$zzb.handleMessage(-1)
android.os.Handler.dispatchMessage(110) android.os.Looper.loop(193)
android.app.ActivityThread.main(5292)
java.lang.reflect.Method.invokeNative(-2)
java.lang.reflect.Method.invoke(515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(828)
com.android.internal.os.ZygoteInit.main(644)
dalvik.system.NativeStart.main(-2)
The same issue:https://code.google.com/p/android/issues/detail?id=230497
The solution:
feedback the issue to google player support and than the issue will disppear.
or
update the SDK of com.google.android.gms:play-services-gcm to latest version

Firebase Analytics keeps causing errors in Android, why?

After I installed Firebase Analytics in my Android app, I keep getting the following error and crash of the app.
10-03 19:08:03.917 17740-17759/******* E/FA: Task exception on worker thread: 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/data/********/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_4ac10bd34145eacbd51560cb14cd41a784d8c1aa-classes.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
Any idea why and what causes this error?
I think something was wrong in the documentation. The instructions didn't tell me this extra step.
I was missing a dependency:
compile 'com.google.firebase:firebase-core:9.6.1'
In the support docs, however it is clearly mentioned. I added it and it works fine now.
What Firebase version are you using? Try to update it to latest version, 9.6
Reference: https://developers.google.com/android/guides/releases

Getting error java.lang.NoClassDefFoundError: com.google.firebase.FirebaseApp

I am using FCM and while run the app it crashes at FirebaseInstanceId.getInstance().getToken() line and gives below error :
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseApp
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
Can anyone help me for solve this issue?
You have to enable the API in Google project console ,and also create the keys which required for FCM from your project console.
Also try to Uninstall your app once and check,because onTokenRefresh() will call once,
Please follow the below link for more information.
https://developers.google.com/cloud-messaging/android/android-migrate-fcm
Please check below once --
Use Google Play services 9.0.0
Android Studio 1.5 or higher
An Android Studio project and its package name.

Firebase Crash Library - NullPointerException in the console

I've implemented the new Firebase Crash library (https://github.com/firebase/quickstart-android/tree/master/crash) to log error in Android app.
Anyone is having similar problem.
I'm checking errors and on the top I've got:
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes()' on a null object reference
android.util.Base64.decode (Base64.java:118)
com.google.firebase.iid.zzg.zzeH (zzg.java:)
com.google.firebase.iid.zzg.zzeE (zzg.java:)
com.google.firebase.iid.zzd.zzCd (zzd.java:)
com.google.firebase.iid.zzd.zzc (zzd.java:)
com.google.firebase.iid.zzd.getToken (zzd.java:)
com.google.firebase.iid.FirebaseInstanceId.getToken (FirebaseInstanceId.java:)
com.google.firebase.iid.FirebaseInstanceId.zzUo (FirebaseInstanceId.java:)
com.google.firebase.iid.FirebaseInstanceIdService.zza (FirebaseInstanceIdService.java:)
com.google.firebase.iid.FirebaseInstanceIdService.zzm (FirebaseInstanceIdService.java:)
com.google.firebase.iid.zzb$2.run (zzb.java:)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:818)
I have checked but there are not extra proguard rules for Firebase Crash.
Is it bug in the library? Anyone is having similar problem?
I can't reproduce error on my devices.
The error is strange and I don't know in which place in the application. Nothing so I think it's connected to Crash library.
This is not standard nullexception. It's connected to Firebase Crash library. Why I'm thinking this is library bug - there is no sign on my code/activity here.
It was confirmed by Google that this was bug in the InstanceID library.
All you can do right now is to update to the latest version and hope this will be fixed.
compile 'com.google.firebase:firebase-crash:9.4.0'
Note #1
You can see in the comments that some people are still getting this error. At the moment we can't do nothing more than update to the latest version. If you've been using previous version - update to the latest. We need info from Firebase team about it.
Note #2
This seems to be fixed in 9.4.0 but we still need confirmation
Seems to be fixed in
compile 'com.google.firebase:firebase-crash:9.4.0'
This is a bug in the InstanceID library in 9.0, sorry. We've identified a fix and will include it in a future SDK release.
We believe it should be fairly rare, but please comment if you're seeing a large number of devices.
There is a new version of Google Play Services available: 9.2.1. Apparently it has the fix inside. I'll confirm it once I have enough data.

Categories

Resources