I have the problem that the android application says. "The application xxxx Sorry stopped" to work with the push notificaction, when performing the debugger that happens when it passes:
method 1
InstanceID InstanceId = InstanceID.getInstance (context);
token = instanceID.getToken (key_id.toString ()
GoogleCloudMessaging.INSTANCE_ID_SCOPE); getToken error,
method 2
Both an the same mistake
if (googleCloudMessaging == null) {
googleCloudMessaging = GoogleCloudMessaging.getInstance(context);
}
token = googleCloudMessaging.register(key_id);
note that the token is generated but the application is closed, error:
"The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir (android.content.Context)' was expected to be of type virtual but was found to be Instead of direct type (declaration of 'java.lang .reflect.ArtMethod 'appears in /system/framework/core-libart.jar)"
I am using android studio, for cdvCompileSdkVersion = android-22 cdvBuildToolsVersion = 22.0.1
Error:
"FATAL EXCEPTION: main
Process: PID: 11989
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 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
at com.google.android.gms.iid.zzd.zzde(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at com.google.android.gms.iid.InstanceIDListenerService.zzn(Unknown Source)
at com.google.android.gms.iid.InstanceIDListenerService.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2924)
at android.app.ActivityThread.access$2100(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
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:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)"
What could be the problem?
Regards,
The issue you are experiencing is due to an incompatibility between
play-services / firebase sdk v9.0.0
andcom.android.support:appcompat-v7 >= 24
It's possible that you are not depending directly from appcompat-v7 >= 24 but some other dependencies are configured to use the most updated appcompat available.
To fix this issue we just released
play-services / firebase sdk
version 9.0.1This minor release should fix the incompatibility with appcompat-v7 !
Finally this problem is solved on v9.0.2. Just update Google Play Service library.
After updating, another error can occur: finished with non-zero exit value 2 Solution for this one is here: Java finished with non-zero exit value 2 - Android Gradle
I also facing same error.
SOLUTION
Just paste this in your gradle file
This issue is that you have dependencies that include old versions of the support library. CHECK THIS LINK
Here is my gradle file check this
gradle
As far as I have read,
java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist
error, which you encountered after migrating a GCM Client App for Android to Firebase Cloud Messaging, were also encountered by many developers after adding the dependency for Crash Reporting to project-levelbuild.gradle
file:So, if you happen to use Firebase Crash Reporting, you must ensure that crash reporting is multi-process safe. Otherwise, it may cause concurrency issues as stated in Report Crashes - Known Issues.
One probable solution that I found is to set Android context and enable Offline Persistence, wherein you enable it via the FirebaseDatabase object in your MainActivity:
Sample solution in MainActivity.java:
This SO post - java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] helped with my searches. I hope that will help you too.
Google has updated on their release note that this issue is fixed, you just have to update the version to 9.0.2
Here is the release note: https://developers.google.com/android/guides/releases
Solved issue by using below code. Just updated
This solved my GCM error.