What does this error mean:
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)
I am new to android, so I have no idea what can be wrong. I tried to change versions of android support, but it gives another errors in another places. I googled solutions here java.lang.IllegalAccessError: Method 'void android.support.v4.content and here java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.' is inaccessible to class 'com.google.android.gms.iid.zzd'. But it did not help me. I am trying to make it work for two weeks and do not know what to do.
I am getting it when doing this:
FirebaseMessaging.getInstance().subscribeToTopic("name");
FirebaseInstanceId.getInstance().getToken();
My 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
}