姬長信(Redy)

java.lang.IllegalAccessError:Method’void android.su…


我在我的sdk中更新了playservice,我收到了这个错误.我无法访问GCM令牌.在更新sdk之前,我的项目完美运行.

我浪费了整整一天但没有找到任何解决方案.我尝试了this但是在这个依赖项中的gettting错误com.google.android.gms:play-services-plus:9.0.0

这是我的logcat

Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in /data/data/com.hwindiapp.passenger/files/instant-run/dex/slice-com.google.android.gms-play-services-iid-9.0.0_b51865a18dbfbfb3651aaa54856c955adf1e354f-classes.dex)
   at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
   at com.google.android.gms.iid.zzd.(Unknown Source)
   at com.google.android.gms.iid.zzd.(Unknown Source)
   at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
   at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
   at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.processGCMID_user(RegisterFbLoginResCallBack.java:166)
   at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:219)
   at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:153)
   at android.os.AsyncTask$2.call(AsyncTask.java:292)
   at java.util.concurrent.FutureTask.run(FutureTask.java:237)
   at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)?
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)?
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)?
   at java.lang.Thread.run(Thread.java:818)?
12-01 12:23:59.553 18157-18703/com.hwindiapp.passenger E/ACRA: Not adding buildConfig to log. Class Not found : com.VolleyLibFiles.BuildConfig. Please configure 'buildConfigClass' in your ACRA config
12-01 12:24:00.013 18157-19059/com.hwindiapp.passenger E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
 Process: com.hwindiapp.passenger, PID: 18157
 java.lang.RuntimeException: An error occured while executing doInBackground()
     at android.os.AsyncTask$3.done(AsyncTask.java:304)
     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
     at java.lang.Thread.run(Thread.java:818)
  Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in /data/data/com.hwindiapp.passenger/files/instant-run/dex/slice-com.google.android.gms-play-services-iid-9.0.0_b51865a18dbfbfb3651aaa54856c955adf1e354f-classes.dex)
     at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
     at com.google.android.gms.iid.zzd.(Unknown Source)
     at com.google.android.gms.iid.zzd.(Unknown Source)
     at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
     at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
     at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.processGCMID_user(RegisterFbLoginResCallBack.java:166)
     at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:219)
     at com.mainProfile.classFiles.RegisterFbLoginResCallBack$registerFBUser.doInBackground(RegisterFbLoginResCallBack.java:153)
 at android.os.AsyncTask$2.call(AsyncTask.java:292)

在这行代码中显示错误

 InstanceID instanceID = InstanceID.getInstance(mContext);
            GCMregistrationId = instanceID.getToken(CommonUtilities.SENDER_ID, GoogleCloudMessaging.INSTANCE_ID_SCOPE,
                    null);

这是我的傻瓜

    apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias 'hwindi'
            keyPassword '123456'
            storeFile file('D:/Company Projects/Hwindi/Project 2/Play_KeyStore/HwindiKeyStore.jks')
            storePassword '123456'
        }
    }
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.hwindiapp.passenger"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 12
        versionName "1.12"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'lib/arm64-v8a/libcardioDecider.so'
        exclude 'lib/arm64-v8a/libcardioRecognizer.so'
        exclude 'lib/arm64-v8a/libcardioRecognizer_tegra2.so'
        exclude 'lib/arm64-v8a/libopencv_core.so'
        exclude 'lib/arm64-v8a/libopencv_imgproc.so'
        exclude 'lib/armeabi/libcardioDecider.so'
        exclude 'lib/armeabi-v7a/libcardioDecider.so'
        exclude 'lib/armeabi-v7a/libcardioRecognizer.so'
        exclude 'lib/armeabi-v7a/libcardioRecognizer_tegra2.so'
        exclude 'lib/armeabi-v7a/libopencv_core.so'
        exclude 'lib/armeabi-v7a/libopencv_imgproc.so'
        exclude 'lib/mips/libcardioDecider.so'
        exclude 'lib/x86/libcardioDecider.so'
        exclude 'lib/x86/libcardioRecognizer.so'
        exclude 'lib/x86/libcardioRecognizer_tegra2.so'
        exclude 'lib/x86/libopencv_core.so'
        exclude 'lib/x86/libopencv_imgproc.so'
        exclude 'lib/x86_64/libcardioDecider.so'
        exclude 'lib/x86_64/libcardioRecognizer.so'
        exclude 'lib/x86_64/libcardioRecognizer_tegra2.so'
        exclude 'lib/x86_64/libopencv_core.so'
        exclude 'lib/x86_64/libopencv_imgproc.so'
    }
    configurations.all {
        /*resolutionStrategy {
            force 'com.android.support:design:23.4.0'
            force 'com.android.support:support-v4:23.4.0'
            force 'com.android.support:appcompat-v7:23.4.0'
        }*/
    }
}
repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile ('com.squareup:fest-android:1.0.8') {
        exclude module: 'support-v4'
    }
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:design:24.2.0'
    compile 'com.android.support:cardview-v7:24.2.0'
    compile 'com.android.support:recyclerview-v7:24.2.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile 'com.google.android.gms:play-services-location:9.0.0'
    compile 'com.google.android.gms:play-services-maps:9.0.0'
    compile 'com.google.android.gms:play-services-plus:9.0.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.paypal.sdk:paypal-android-sdk:2.13.3'
    compile 'com.wdullaer:materialdatetimepicker:2.2.0'
    compile 'com.mukesh:permissions:1.0.3'
}