Android 应用程序在前 Android 5 台设备上崩溃

Android App crashes on pre Android 5 devices

我最近更新了我的sdks,播放服务等等。当我 运行 我的应用程序在 devices/emulators 上使用 pre-Lollipop Android 时,它立即出现以下错误:

java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
                                                            at com.google.firebase.FirebaseApp.zzeh(Unknown Source)
                                                            at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                                                            at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
                                                            at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                            at android.app.ActivityThread.installProvider(ActivityThread.java:4819)
                                                            at android.app.ActivityThread.installContentProviders(ActivityThread.java:4432)
                                                            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372)
                                                            at android.app.ActivityThread.access00(ActivityThread.java:141)
                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
                                                            at android.os.Handler.dispatchMessage(Handler.java:99)
                                                            at android.os.Looper.loop(Looper.java:137)
                                                            at android.app.ActivityThread.main(ActivityThread.java:5041)
                                                            at java.lang.reflect.Method.invokeNative(Native Method)
                                                            at java.lang.reflect.Method.invoke(Method.java:511)
                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
                                                            at dalvik.system.NativeStart.main(Native Method)

我什至没有使用 Firebase! 以下是我的 gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 24
    buildToolsVersion '24.0.1'
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    defaultConfig {
        applicationId "com.Myapp"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 2
        versionName "2"
        multiDexEnabled true
    }
    buildTypes {
        release {}
    }
    productFlavors {
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/Kryptonz-sdk.jar')
    compile 'com.android.support:appcompat-v7:24.1.0'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.github.greenfrvr:hashtag-view:1.2.1'
    compile 'com.google.android.gms:play-services:9.2.1'
    compile 'com.android.support:cardview-v7:24.1.0'
    compile 'com.android.support:recyclerview-v7:24.1.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
    compile 'com.android.support:support-v4:24.1.0'
    compile 'com.android.support:design:24.1.0'
}

firebase 现在有可能包含在 play 服务中吗?如果为真,我该如何排除它? 非常感谢。

您可以为 Firebase 添加依赖项

compile 'com.firebase:firebase-client-android:2.4.0'