2016-06-13 51 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的步驟使用資源並將該庫添加到您的應用程序項目中。