这个错误意味着什么:
Task exception on worker thread: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/name.name.name.name-1/base.apk): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
我是android的新手,所以我不知道什么是错的。 我试图改变android支持的版本,但它在另一个地方给出了另一个错误。我在这里使用谷歌搜索解决方案java.lang.IllegalAccessError: Method 'void android.support.v4.content和java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.' is inaccessible to class 'com.google.android.gms.iid.zzd'。但它没有帮助我。我想让它工作两周,不知道该怎么做。
我这样做是为了得到它:
FirebaseMessaging.getInstance().subscribeToTopic("name");
FirebaseInstanceId.getInstance().getToken();
我的build.gradle(app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "name.name.name.name"
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile files('libs/urlimageviewhelper-1.0.4.jar')
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
apply plugin: 'com.google.gms.google-services'
build.gradle(project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}