这是执行InstanceID instanceID时显示的错误。

'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzb
    07-25 15:08:54.919 19852-19874/? E/AndroidRuntime: FATAL EXCEPTION: IntentService[]
                                                       java.lang.IncompatibleClassChangeError: android.support.v4.content.ContextCompat
                                                           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 nath.prem.com.premgcmproject.GCMRegistrationIntentService.registerGCM(GCMRegistrationIntentService.java:60)
                                                           at nath.prem.com.premgcmproject.GCMRegistrationIntentService.onHandleIntent(GCMRegistrationIntentService.java:41)
                                                           at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
                                                           at android.os.Handler.dispatchMessage(Handler.java:99)
                                                           at android.os.Looper.loop(Looper.java:153)
                                                           at android.os.HandlerThread.run(HandlerThread.java:60)
    07-25 15:08:54.961 520-539/? E/AppErrorDialog: Failed to get

最佳答案

尝试将其添加到build.gradle中的依赖项中

compile 'com.android.support:appcompat-v7:23.4.0'

这样的SO-IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM可能也对您有帮助。

关于compiler-errors - 执行时出错-InstanceID instanceID = InstanceID.getInstance(getApplication());,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38564451/

10-12 01:18