我已将我的应用程序更新到新的firebase使用,现在当我使用Android Kitkat在设备上编译我的项目时,我得到以下异常,但在Android Lollipop上正常运行
这是我在Android Kitkat上运行时的logcat:
AndroidRuntime: FATAL EXCEPTION: main
Process: com.lemon.kenhnhacvn, PID: 23133
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.zzek(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:4818)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4413)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4353)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5045)
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:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
我的Build.gradle:
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':searchlibrary')
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:palette-v7:24.1.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.10.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
有人可以帮我解决这个问题吗?
答案 0 :(得分:1)
在你的情况下
从build.gradle
文件中删除此依赖关系
compile 'com.google.android.gms:play-services:9.4.0'
并添加这样的单独的
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
这可以解决你的问题。
答案 1 :(得分:0)
从SDK Manager下载最新的Google Play服务。 并在Build.gradle中编译最新的Google Play服务
答案 2 :(得分:0)
在最高级别的gradle上:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
在App level gradle上:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.firebase:firebase-client-android:2.3.1'
}
apply plugin: 'com.google.gms.google-services'