我在我的 sdk 中更新了 playservice,但出现了这个错误.而且我无法访问 GCM 令牌.在更新 sdk 之前,我的项目运行良好.
I updated playservice in my sdk and I got this error. And I am not able to access GCM Token. Before update sdk my project work perfectly.
我浪费了一整天的时间,但没有找到任何解决方案.我尝试了 this 但在此依赖项 com 中出现错误.google.android.gms:play-services-plus:9.0.0
I waste my whole day in it but not found any solution. I tried this but gettting error in this dependencies com.google.android.gms:play-services-plus:9.0.0
这是我的logcat
Caused by: 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/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.<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.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.<init>()' 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.<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.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);
这是我的gradle
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'
}
请检查您的 声明的依赖关系.正如给定的 documentation 中所讨论的,有三种不同类型的直接app/模块的 build.gradle
文件中的依赖项.
Please check your declared dependencies. As discussed in the given documentation there are three different types of direct dependencies in the app/ module's build.gradle
file.
示例依赖如下:
android {...}
...
dependencies {
// The 'compile' configuration tells Gradle to add the dependency to the
// compilation classpath and include it in the final package.
// Dependency on the "mylibrary" module from this project
compile project(":mylibrary")
// Remote binary dependency
compile 'com.android.support:appcompat-v7:25.0.1'
// Local binary dependency
compile fileTree(dir: 'libs', include: ['*.jar'])
}
此外,正如 @Diego Giorgini 在相关 所以发布,
Furthermore, as answered by @Diego Giorgini in a related SO post,
您遇到的问题是由于play-services/firebase sdk v9.0.0
和 com.android.support:appcompat-v7 >= 24
(随android-N sdk发布的版本)
The issue you are experiencing is due to an incompatibility between
play-services / firebase sdk v9.0.0
andcom.android.support:appcompat-v7 >= 24
(the version released with android-N sdk)
有了这个,您可能想尝试建议的修复:
With this, you may want to try the suggested fix:
您应该能够通过针对早期版本的支持库来修复它.喜欢:
You should be able to fix it by targeting an earlier version of the support library. Like:
编译'com.android.support:appcompat-v7:23.4.0'
您可能还想查看以下 SO 帖子中的其他建议:
You may want to also check the other suggestions in the following SO posts:
这篇关于java.lang.IllegalAccessError: 方法 'void android.support.v4.content的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!