My application used GCM push notification service. Everything worked fine until I recently updated the SDK version to 25
This is what app gradle looked like:
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { applicationId "com.frienddime.frienddime" minSdkVersion 10 targetSdkVersion 23 versionCode 107 versionName "1.2.3" } ... } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.android.support:cardview-v7:23.3.0' compile 'com.android.support:recyclerview-v7:23.3.0' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.vk:androidsdk:+' compile 'com.google.android.gms:play-services:8.3.0' } And after the update, this error began to take off. The line of code pointed to by the error is exactly where the GCM registration service is trying to get the GCM token.
FATAL EXCEPTION: IntentService[] java.lang.IllegalAccessError: tried to access method android.support.v4.content.ContextCompat.<init>:(Ljava/lang/String;)V from class com.google.android.gms.iid.zzd at com.google.android.gms.iid.zzd.zzdL(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.frienddime.frienddime.GCMRegistrationIntentService.registerGCM(GCMRegistrationIntentService.java:31) at com.frienddime.frienddime.GCMRegistrationIntentService.onHandleIntent(GCMRegistrationIntentService.java:24) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.os.HandlerThread.run(HandlerThread.java:60) I tried to change compileSdkVersion 25, buildToolsVersion "25.0.0", targetSdkVersion 25. Then I found in Google that this is the case in compile 'com.google.android.gms: play-services: 8.3.0', that the pier must be changed to the last version of. However, I tried to change to the one that was recommended 9.8.0, but as a result, the graidle gave an error that this version is incompatible with other libraries. I tried the latest version 10.0.1, but the same. I changed the version of com.android.support to 25.1.0 and this also did not help.
Why does this error occur and how to solve it?