NoClassDefFoundError:无法解决以下问题:Lcom / google / android / gms / common / internal / zzx

时间:2018-09-17 13:13:01

标签: android firebase

我正在使用

pub.devrel:easygoogle:0.2.5

com.google.firebase:firebase-core:16.0.1

我正在制作一个简单的通知应用程序,它可以从FCM发送通知。 我正在关注this,但在运行时出现错误

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzx;
                                                   at com.google.android.gms.measurement.internal.zzt.zzaU(Unknown Source)
                                                   at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
                                                   at com.google.firebase.analytics.connector.AnalyticsConnectorImpl.getInstance(Unknown Source)
                                                   at com.google.firebase.analytics.connector.internal.zzb.create(Unknown Source)
                                                   at com.google.firebase.components.zzh.zza(SourceFile:28)
                                                   at com.google.firebase.components.zzi.get(Unknown Source)
                                                   at com.google.firebase.components.zzh.get(SourceFile:39)
                                                   at com.google.firebase.components.ComponentContainer$$CC.get(Unknown Source)
                                                   at com.google.firebase.components.zzd.get(SourceFile)
                                                   at com.google.firebase.components.zzd.zza(SourceFile:68)
                                                   at com.google.firebase.FirebaseApp.zze(SourceFile:703)
                                                   at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
                                                   at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
                                                   at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
                                                   at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
                                                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
                                                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
                                                   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
                                                   at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
                                                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
                                                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
                                                   at android.app.ActivityThread.-wrap1(ActivityThread.java)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:148)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzx" on path: DexPathList[[zip file "/data/app/com.apneareamein.autostartapp-1/base.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.apneareamein.autostartapp-1/lib/x86, /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.android.gms.measurement.internal.zzt.zzaU(Unknown Source) 

                                                        ... 30 more
                                                Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

渐变文件-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.myapp.autostart"
        minSdkVersion 19
        targetSdkVersion 27
        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(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:27.+'

    compile 'com.android.support:support-v4:27.+'

    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    testCompile 'junit:junit:4.12'

    compile 'pub.devrel:easygoogle:0.2.5'

    compile 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'

我添加了构建gradle文件以获取更多详细信息。我扩展了EasyMessageService的通知功能。

如果需要更多详细信息,请告诉我。 该如何解决?

谢谢。

1 个答案:

答案 0 :(得分:0)

我也喜欢这个问题。我有一个旧版本的google和其他服务,例如google service 1.5.0-beta2想要在android 10设备上运行,并给了我一个错误。

Didn't find class "com.google.android.gms.common.internal.zzx" 

然后,我将所有库更新为最新版本。然后工作。