我的应用程序在Android 7.0上崩溃了

时间:2017-11-02 14:13:57

标签: java android

我开发了一款Android应用,它在Android 6.0上完美运行。 在我更新到新的Android 7.0之后,应用程序崩溃了。 logcat的堆栈跟踪是:

FATAL EXCEPTION: main Process: com.plexis.holford, PID: 28306 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 'com.google.firebase.iid.zzg' appears in /data/app/com.plexis.holford-1/split_lib_dependencies_apk.apk:classes10.dex)
                       at com.google.firebase.iid.zzg.zzeC(Unknown Source)
                       at com.google.firebase.iid.zzg.<init>(Unknown Source)
                       at com.google.firebase.iid.zzg.<init>(Unknown Source)
                       at com.google.firebase.iid.zzd.zzb(Unknown Source)
                       at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
                       at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
                       at com.plexis.holford.MainActivity.displayFirebaseRegId(MainActivity.java:216)
                       at com.plexis.holford.MainActivity.onCreate(MainActivity.java:201)
                       at android.app.Activity.performCreate(Activity.java:6910)
                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
                       at android.app.ActivityThread.-wrap12(ActivityThread.java)
                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
                       at android.os.Handler.dispatchMessage(Handler.java:105)
                       at android.os.Looper.loop(Looper.java:156)
                       at android.app.ActivityThread.main(ActivityThread.java:6531)
                       at java.lang.reflect.Method.invoke(Native Method)
                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)

我已禁用即时运行,并重新构建应用,但没有成功。

修改 build.gradle内容

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.0'

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

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    // compile 'com.google.android.gms:play-services:11.0.2'

    //    compile 'com.google.android.gms:play-services:11.0.2'
    compile 'com.google.firebase:firebase-messaging:9.0.0'
    compile 'com.android.support:cardview-v7:24.0.0'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.google.android.gms:play-services-location:9.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    testCompile 'junit:junit:4.12'
}
//apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'

修改-2 当我点击登录应用程序崩溃时,应用程序主要活动正在启动而没有错误。 我停止了注册到FireBase的代码,现在应用程序正常工作。 我将检查哪个语句引发错误并在此处发布。

修改-3 我的手机正在运行Android 7.0,并且该应用程序运行良好,在删除firebase代码后,但它在同一个Android版本1的另一个手机上崩溃。 有什么想法吗?

0 个答案:

没有答案