2016-06-13 93 views
0

如果我们将GCM发件人ID放在airshipconfig.properties文件中,那么在城市飞艇推送的情况下,应用程序在启动投掷后出现以下错误时发生崩溃。java.lang.IncompatibleClassChangeError:android GCM令牌生成崩溃

错误:

java.lang.IncompatibleClassChangeError:该方法 '的java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' 预计是类型的虚拟而是被认为是直接类型(声明 'java.lang.reflect.ArtMethod' 的出现在/system/framework/core-libart.jar)

gradle这个文件的:

buildscript { 
    repositories { 

     maven { url 'https://maven.fabric.io/public' } 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 

repositories { 
    maven { 
     url 'https://maven.fabric.io/public' 
    } 

    maven { url "https://urbanairship.bintray.com/android" } 

    maven { url "https://jitpack.io" } 
} 


android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.0 rc2" 

    defaultConfig { 
     applicationId "com.samachar.newskannada" 
     minSdkVersion 14 
     targetSdkVersion 22 
     versionCode 2 
     versionName "1.0" 
    } 
    buildTypes { 
     debug { 
      buildConfigField 'String', 'CONTAINER_ID', '"containedid"' //Development 
      buildConfigField 'boolean', 'GTM_VERBOSE_ENABLE', 'true' 
      buildConfigField 'String', 'APP_KEY', '"appkey"' 
      minifyEnabled false 
      shrinkResources false 
     } 
     release { 
      buildConfigField 'String', 'CONTAINER_ID', '"GTM_id"' //Development 
      buildConfigField 'boolean', 'GTM_VERBOSE_ENABLE', 'true' 
      buildConfigField 'String', 'APP_KEY', '"appkey"' 
      //progard 
      minifyEnabled true 
      shrinkResources true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'com.android.support:design:23.0.1' 
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0' 
    compile 'com.google.code.gson:gson:2.2.4' 
    compile 'com.android.support:recyclerview-v7:+' 
    compile 'com.github.bumptech.glide:glide:3.6.0' 
    // Urban Airship SDK 
    compile 'com.urbanairship.android:urbanairship-sdk:7.0.+' 
    // Recommended for in-app messaging 
    compile 'com.android.support:cardview-v7:23.1.1' 
    // Recommended for location services 
    compile 'com.google.android.gms:play-services-location:8.4.0' 
    compile 'com.google.android.gms:play-services-analytics:8.4.0' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile project(':Volley') 
    compile 'com.github.ybq:Android-SpinKit:1.0.2' 
    compile "com.squareup.picasso:picasso:2.4.0" 
    compile 'com.github.amlcurran.showcaseview:library:5.4.3' 
    compile "org.jsoup:jsoup:1.8.1" 
} 

任何人都可以帮忙我有这个问题吗?

+0

你还在遇到这个问题吗? –

回答

0

错误是使用File getFilesDir()创建的文件,返回文件系统上存储用openFileOutput(String, int)创建的文件的目录的绝对路径。

如果调用应用程序移动到采用的存储设备,则返回的路径可能会随时间而改变,因此只应保留相对路径。

getNoBackupFilesDir被发现在android.support.v4.content.ContextCompat。似乎问题在于项目中包含了一个旧的appcompat-v7。

尝试使用SDK管理器下载latest version of Android Support Library,然后按照Adding libraries的步骤使用资源并将该库添加到您的应用程序项目中。