1

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!

Yasir Tahir
  • 790
  • 1
  • 11
  • 31
  • 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/com.notnul.notnul-1/base.apk) at com.notnul.notnul.RegistrationIntentService.onHandleIntent(RegistrationIntentService.java:53) this is my logcat @ Yashir Tahir – Kishan Singh Jun 05 '16 at 11:23
  • Did you try clean build? – Eugen Pechanec Jun 05 '16 at 13:07
  • For additional inputs you can check the gradle dependecies tree by typing `gradle -q app:dependencies --configuration compile` then update the dependencies in `build.gradle` like: `compile('com.mcxiaoke.viewpagerindicator:library:2.4.1') { exclude module: 'support-v4'; } compile 'com.android.support:support-v4:23.4.0'`. You can check [Diego Giorgini's](http://stackoverflow.com/a/37356831/5995040) or [stegranet's](http://stackoverflow.com/a/37355739/5995040) implementation. Hope this help. – Mr.Rebot Jun 08 '16 at 06:11

1 Answers1

3

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().

Community
  • 1
  • 1
Eugen Pechanec
  • 37,669
  • 7
  • 103
  • 124
  • if( !sharedPreferences.getBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER,false)) { instanceID = InstanceID.getInstance(this); try { GCM_Token = instanceID.getToken(authorizedEntity, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); } catch (IOException e) { e.printStackTrace(); } GCM_InstaceID = instanceID.getInstance(getApplicationContext()).getId(); sendRegistrationToServer(GCM_Token); }help me for this – Kishan Singh Jun 07 '16 at 08:38
  • @KishanSingh If you have a solution, post it as a properly formatted answer. Thanks. – Eugen Pechanec Oct 25 '16 at 08:30