我正在尝试在我的应用程序中实现 Fire Base
。它在 Lollipop
及以上版本中工作正常。
运行 pre lollipop 时出现错误:
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4825)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4420)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4360)
at android.app.ActivityThread.access$1500(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
在我的 Gradle 中:
defaultConfig {
applicationId "com.manoramaonline.mmc.year2017"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled true
}
dependencies {
compile project(':library')
compile project(':wheel')
compile project(':socialauthandroid')
compile project(':ambilWarna')
compile files('libs/acra-4.5.0.jar')
compile files('libs/FlurryAgent.jar')
compile files('libs/poi-3.9.jar')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
compile files('libs/InMobi-5.3.1.jar')
compile 'com.android.support:cardview-v7:23.3.+'
compile 'com.android.support:recyclerview-v7:23.3.+'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.googlecode.json-simple:json-simple:1.1'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:multidex:1.0.1'
}
我尝试添加 MultiDex
作为依赖项并在默认配置中启用它。但没有修复解决方案。
我认为问题是 64k 引用限制
但不知道如何解决。
最佳答案
我也遇到了同样的问题,我只是降级了 google play-service 依赖项来编译 'com.google.android.gms:play-services:8.4.0'
问题就解决了.
关于Android:Firebase 在 4.4.4 中无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40339043/