在棒棒糖上启动时,发布应用程序崩溃

时间:2018-07-26 10:36:39

标签: android firebase google-play-services android-5.0-lollipop

仅在发布模式下,我的应用程序在仅棒棒糖设备上启动时崩溃。在调试和发布模式下,它都可以在棒棒糖以上的所有操作系统上完美运行。但是仅在RELEASE模式下在棒棒糖上崩溃。以下是崩溃日志:

07-26 14:49:12.276 880-880/? E/AndroidRuntime: FATAL EXCEPTION: main                                               
                                           java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
                                               at com.google.firebase.FirebaseApp.<clinit>(Unknown Source)
                                               at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1716)
                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1685)
                                               at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                               at android.app.ActivityThread.installProvider(ActivityThread.java:5568)
                                               at android.app.ActivityThread.installContentProviders(ActivityThread.java:5163)
                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5103)
                                               at android.app.ActivityThread.access$1600(ActivityThread.java:177)
                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1510)
                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                               at android.os.Looper.loop(Looper.java:145)
                                               at android.app.ActivityThread.main(ActivityThread.java:5951)
                                               at java.lang.reflect.Method.invoke(Native Method)
                                               at java.lang.reflect.Method.invoke(Method.java:372)
                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
                                            Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/com.hmny.zoneintelligence-1/base.apk"],nativeLibraryDirectories=[/data/app/com.hmny.zoneintelligence-1/lib/arm, /vendor/lib, /system/lib]]
                                               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                               at com.google.firebase.FirebaseApp.<clinit>(Unknown Source) 
                                               at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1716) 
                                               at android.content.ContentProvider.attachInfo(ContentProvider.java:1685) 
                                               at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
                                               at android.app.ActivityThread.installProvider(ActivityThread.java:5568) 
                                               at android.app.ActivityThread.installContentProviders(ActivityThread.java:5163) 
                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5103) 
                                               at android.app.ActivityThread.access$1600(ActivityThread.java:177) 
                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1510) 
                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                               at android.os.Looper.loop(Looper.java:145) 
                                               at android.app.ActivityThread.main(ActivityThread.java:5951) 
                                               at java.lang.reflect.Method.invoke(Native Method) 
                                               at java.lang.reflect.Method.invoke(Method.java:372) 
                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388) 
                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183) 
                                            Suppressed: java.lang.ClassNotFoundException: android.support.v4.util.ArrayMap
                                               at java.lang.Class.classForName(Native Method)
                                               at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                               at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                    ... 18 more
                                            Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

我怀疑这是由于Google Play库和Firebase库之间的版本冲突引起的。以下是我的代码:

build.gradle

dependencies {
compile project(':stickyrecyclerview')
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation "com.android.support:appcompat-v7:${rootProject.ANDROID_SUPPORT_LIBS_VERSION}"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services:11.+'
compile 'com.google.android.gms:play-services-location:11+'
implementation 'com.google.android.gms:play-services-auth:11.+'
implementation 'com.google.firebase:firebase-auth:11.+'
compile 'com.google.android.gms:play-services-plus:11.+'
//Architecture components
implementation "android.arch.lifecycle:extensions:1.1.0"
implementation "com.android.support:support-v4:${rootProject.ANDROID_SUPPORT_LIBS_VERSION}"
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
compile 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
compile "com.android.support:design:${rootProject.ANDROID_SUPPORT_LIBS_VERSION}"
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
compile "com.android.support:cardview-v7:${rootProject.ANDROID_SUPPORT_LIBS_VERSION}"
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.twilio:voice-android:2.0.6'
compile 'com.google.android.gms:play-services-places:11.+'
// FCM dependencies
compile 'com.google.firebase:firebase-messaging:11.+'
compile 'com.google.firebase:firebase-core:11.+'


// glide image library
implementation 'com.github.bumptech.glide:glide:4.7.1'

compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
    transitive = true;
}

compile group: 'com.pubnub', name: 'pubnub-gson', version: '4.19.0'
//social login authentication sdk
compile 'com.facebook.android:facebook-android-sdk:4.+'
implementation 'com.hbb20:ccp:2.2.0'
implementation 'io.michaelrocks:libphonenumber-android:8.9.5'
}
apply plugin: 'com.google.gms.google-services'

请帮帮我。让我知道是否需要更多信息。预先感谢!

2 个答案:

答案 0 :(得分:0)

尝试在您的proguard rules.txt文件中添加此行

#支持v4
-keep类android.support.v4。** {*; }
-keep接口android.support.v4。** {*; }

答案 1 :(得分:0)

解决了此更改的问题。在应用程序级别的build.gradle文件中,我正在使用

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
}

我将其更改为

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
}