如何解决java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir

时间:2016-08-26 09:41:25

标签: android push-notification

在使用gcm任务的Android推送通知期间,我收到了这些错误。请提供建议。

我附上了我的应用程序的build.gradle详细信息。给出建议并帮助我解决:

FATAL EXCEPTION: IntentService[]
Process: push.gcm.android.com.pushsample, PID: 7930
java.lang.IncompatibleClassChangeError: 
Methodjava.io.Fileandroid.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)

的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
    applicationId "push.gcm.android.com.pushsample"
    minSdkVersion 15
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

 dependencies {
 compile fileTree(include: ['*.jar'], dir: 'libs')
 testCompile 'junit:junit:4.12'
 compile 'com.android.support:appcompat-v7:24.1.1'
 compile 'com.android.support:design:24.1.1'
 compile 'com.google.android.gms:play-services-gcm:8.3.0'
  }
 apply plugin: 'com.google.gms.google-services'

感谢。

1 个答案:

答案 0 :(得分:0)

Google Play服务与某些版本的Android支持库存在已知的兼容性问题。请将您的com.google.android.gms:play-services-gcm:8.3.0'升级到最新版本。