GCM unregister causing the application to crash
Solution 1
I was with same problem after update the support library to 25.0.0 . For me after update the below libs,in the app gradle file, the problem gone.
compile("com.google.android.gms:play-services-location:9.6.1")
compile("com.google.android.gms:play-services-maps:9.6.1")
compile("com.google.android.gms:play-services-gcm:9.6.1")
Solution 2
Update the google play services to the latest version (9.8.0) after updating the android support library to 25.0.0 I had the same problem this morning and this worked for me :)
Solution 3
Not sure this will solve your problem, but it's always a good idea to pass the application Context
to third party frameworks, rather than Activity
instances, as the latter can lead to memory leaks. Try this instead:
InstanceID instanceID = InstanceID.getInstance(getApplicationContext());
Related videos on Youtube
Zeeshan Ali
Experienced Software Developer who can bring a diverse skill set and creative drive to software application development. Proficient with designing and business logic, writing code in various languages, and feature development and implementation. Specialize in thinking outside the box to find the unique solutions to difficult engineering problems.
Updated on September 15, 2022Comments
-
Zeeshan Ali over 1 year
I've implemented GCM notifications on my app. I am now trying to un-register the app when the user logs out. I am using the following code. When this code executes, it causes the application to crash with the following logcat:
java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in /data/app/com.example.packagename-1/base.apk) at com.google.android.gms.iid.zzd.zzeb(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.zaryans.updatedepoultry.WelcomeActivity$11.onItemClick(WelcomeActivity.java:469) at android.widget.AdapterView.performItemClick(AdapterView.java:310) at android.widget.AbsListView.performItemClick(AbsListView.java:1145) at android.widget.AbsListView$PerformClick.run(AbsListView.java:3066) at android.widget.AbsListView$3.run(AbsListView.java:3903) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Here is the code:
InstanceID instanceID = InstanceID.getInstance(WelcomeActivity.this); try { instanceID.deleteInstanceID(); Utility.logCatMsg("Logged Out Success!!!"); } catch (IOException e) { Utility.logCatMsg("Exception while logging out: "+e.getMessage()); e.printStackTrace(); }
-
Vidya Sagar over 7 yearsFor me, compiling facebooksdk created this problem
-
-
Zeeshan Ali over 7 yearsI tired, but no luck :-(
-
Zeeshan Ali over 7 yearsIt helped me. Thanks alot :-)
-
Francesco Frascà over 7 yearsI tried to update but doesn't resolve anything. Still the same error
-
Arpit Patel over 7 yearsi tried this way but no luck can you please help me here is my question stackoverflow.com/questions/40904466/…
-
pasanbuddhika over 7 yearsWhat's the google-services plugin version that you used? I got version conflict error while trying to update 9.6.1.
-
luizMello about 7 years@pasanbuddhika I used version 3.0.0