I catch such an error:

java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar) 

When trying to execute this code:

 FirebaseInstanceId.getInstance().getToken(); 

build.gradle

 apply plugin: 'com.android.application' apply plugin: 'realm-android' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.exaple" minSdkVersion 16 targetSdkVersion 23 versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') wearApp project(':wear') compile project(':common') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.android.support:design:23.0.0' //GOOGLE SERVICES compile 'com.google.android.gms:play-services-auth:9.0.0' compile 'com.google.android.gms:play-services-gcm:9.0.0' compile 'com.google.android.gms:play-services-appindexing:9.0.0' compile 'com.google.android.gms:play-services-wearable:9.0.0' //FACEBOOK compile 'com.facebook.android:facebook-android-sdk:4.6.0' //FireBase dependency compile 'com.google.firebase:firebase-invites:9.0.0' compile 'com.google.firebase:firebase-messaging:9.0.0' } apply plugin: 'com.google.gms.google-services' 

    1 answer 1

    The problem was solved quickly by changing the versions of the connected libraries!

    from versions:

     //GOOGLE SERVICES compile 'com.google.android.gms:play-services-auth:9.0.0' compile 'com.google.android.gms:play-services-gcm:9.0.0' compile 'com.google.android.gms:play-services-appindexing:9.0.0' compile 'com.google.android.gms:play-services-wearable:9.0.0' //FireBase dependency compile 'com.google.firebase:firebase-invites:9.0.0' compile 'com.google.firebase:firebase-messaging:9.0.0' 

    replaced the latest versions:

     //GOOGLE SERVICES compile 'com.google.android.gms:play-services-auth:9.4.0' compile 'com.google.android.gms:play-services-gcm:9.4.0' compile 'com.google.android.gms:play-services-appindexing:9.4.0' compile 'com.google.android.gms:play-services-wearable:9.4.0' //FireBase dependency compile 'com.google.firebase:firebase-invites:9.4.0' compile 'com.google.firebase:firebase-messaging:9.4.0'