1
每當我跑我的應用程序我得到這個在日誌中:拋出java.lang.ClassNotFoundException與com.google.android.gms.measurement.internal.UserAttributeParcel
java.lang.Class<com.google.android.gms.measurement.internal.UserAttributeParcel>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable;
06-22 16:39:48.124 6169-6169/? I/art: at java.lang.Class java.lang.Class.classForName!(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
06-22 16:39:48.124 6169-6169/? I/art: at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:400)
06-22 16:39:48.124 6169-6169/? I/art: at java.lang.Class java.lang.Class.forName(java.lang.String) (Class.java:326)
06-22 16:39:48.124 6169-6169/? I/art: at void com.google.firebase.FirebaseApp.zza(java.lang.Class, java.lang.Object, java.lang.Iterable) ((null):-1)
06-22 16:39:48.124 6169-6169/? I/art: at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions, java.lang.String) ((null):-1)
06-22 16:39:48.124 6169-6169/? I/art: at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions) ((null):-1)
06-22 16:39:48.124 6169-6169/? I/art: at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context) ((null):-1)
06-22 16:39:48.124 6169-6169/? I/art: at boolean com.google.firebase.provider.FirebaseInitProvider.onCreate() ((null):-1)
06-22 16:39:48.124 6169-6169/? I/art: at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1793)
06-22 16:39:48.124 6169-6169/? I/art: at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1762)
06-22 16:39:48.124 6169-6169/? I/art: at void com.google.firebase.provider.FirebaseInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) ((null):-1)
06-22 16:39:48.124 6169-6169/? I/art: at android.app.IActivityManager$ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.IActivityManager$ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:6205)
06-22 16:39:48.124 6169-6169/? I/art: at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5768)
06-22 16:39:48.124 6169-6169/? I/art: at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5707)
06-22 16:39:48.124 6169-6169/? I/art: at void android.app.ActivityThread.-wrap2(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
06-22 16:39:48.124 6169-6169/? I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1577)
06-22 16:39:48.124 6169-6169/? I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
06-22 16:39:48.124 6169-6169/? I/art: at void android.os.Looper.loop() (Looper.java:173)
06-22 16:39:48.124 6169-6169/? I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6523)
06-22 16:39:48.124 6169-6169/? I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
06-22 16:39:48.124 6169-6169/? I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:938)
06-22 16:39:48.124 6169-6169/? I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:828)
06-22 16:39:48.124 6169-6169/? I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable" on path: DexPathList[[zip file "/data/app/com.medishare.zeeromed-2/base.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.medishare.zeeromed-2/split_lib_slice_9_apk.apk"]
06-22 16:39:48.124 6169-6169/? I/art: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
06-22 16:39:48.125 6169-6169/? I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
06-22 16:39:48.125 6169-6169/? I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
06-22 16:39:48.125 6169-6169/? I/art: at java.lang.Class java.lang.Class.classForName!(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
06-22 16:39:48.125 6169-6169/? I/art: at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:400)
06-22 16:39:48.125 6169-6169/? I/art: at java.lang.Class java.lang.Class.forName(java.lang.String) (Class.java:326)
06-22 16:39:48.125 6169-6169/? I/art: at void com.google.firebase.FirebaseApp.zza(java.lang.Class, java.lang.Object, java.lang.Iterable) ((null):-1)
06-22 16:39:48.125 6169-6169/? I/art: at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions, java.lang.String) ((null):-1)
06-22 16:39:48.125 6169-6169/? I/art: at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions) ((null):-1)
06-22 16:39:48.125 6169-6169/? I/art: at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context) ((null):-1)
06-22 16:39:48.125 6169-6169/? I/art: at boolean com.google.firebase.provider.FirebaseInitProvider.onCreate() ((null):-1)
06-22 16:39:48.125 6169-6169/? I/art: at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1793)
06-22 16:39:48.125 6169-6169/? I/art: at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1762)
06-22 16:39:48.125 6169-6169/? I/art: at void com.google.firebase.provider.FirebaseInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) ((null):-1)
06-22 16:39:48.125 6169-6169/? I/art: at android.app.IActivityManager$ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.IActivityManager$ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:6205)
06-22 16:39:48.125 6169-6169/? I/art: at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5768)
06-22 16:39:48.125 6169-6169/? I/art: at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5707)
06-22 16:39:48.125 6169-6169/? I/art: at void android.app.ActivityThread.-wrap2(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
06-22 16:39:48.125 6169-6169/? I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1577)
06-22 16:39:48.125 6169-6169/? I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
06-22 16:39:48.125 6169-6169/? I/art: at void android.os.Looper.loop() (Looper.java:173)
06-22 16:39:48.125 6169-6169/? I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6523)
06-22 16:39:48.125 6169-6169/? I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
06-22 16:39:48.125 6169-6169/? I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:938)
06-22 16:39:48.125 6169-6169/? I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:828)
網上搜索後,我猜它是由引起我的build.gradle裏面的一個不兼容性。解決它之後,我仍然在日誌中獲得這些行。有趣的是,即使每次拋出這個錯誤,一切都在應用程序內按預期工作。我的另一個猜測是,這是由於我前一段時間將所有云端功能轉換爲Firebase併發生了一些錯誤。感謝您的幫助。
我的應用程序的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
renderscriptTargetApi 25
renderscriptSupportModeEnabled false
applicationId "com.medishare.zeeromed"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//compile project(path: ':subProject:android-networking')
apply plugin: 'com.google.gms.google-services'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'devs.mulham.horizontalcalendar:horizontalcalendar:1.1.5'
compile 'com.github.sundeepk:compact-calendar-view:2.0.1'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.github.florent37:viewanimator:1.0.5'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
//compile 'com.github.shalskar:PeekAndPop:1.1.0'
compile 'com.android.support:customtabs:25.3.1'
compile 'com.google.firebase:firebase-messaging:11.0.0'
compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.github.bassaer:chatmessageview:1.3.3'
compile 'com.github.simbiose:Encryption:2.0.0'
compile 'com.google.firebase:firebase-database:11.0.0'
compile 'com.irozon.sneaker:sneaker:1.0.1'
compile 'com.wdullaer:materialdatetimepicker:3.2.2'
compile 'com.github.ybq:Android-SpinKit:1.0.5'
testCompile 'junit:junit:4.12'
debugCompile 'com.amitshekhar.android:debug-db:1.0.0'
compile 'com.amitshekhar.android:android-networking:1.0.0'
}
// apply plugin: 'com.google.gms.google-services'
後您的應用程序模塊的build.gradle。 –