由java.lang.ClassNotFoundException引起找不到类“ com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver

时间:2018-09-03 10:18:00

标签: java android

我正在开发一个Android应用程序,并添加了基于Fire的crashlytics,但是在某些设备中,我不断遇到以下问题

请问有人可以帮助我如何解决此问题

等级:

   dependencies {
    //noinspection GradleCompatible
    implementation 'com.android.support:support-v4:26.1.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'com.google.code.gson:gson:2.7'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    testImplementation 'junit:junit:4.12'
    //noinspection GradleCompatible
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
    implementation 'com.squareup.picasso:picasso:2.3.2'
    implementation 'com.baoyz.pullrefreshlayout:library:1.2.0'
    implementation 'com.cocosw:bottomsheet:1.+@aar'
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'id.zelory:compressor:2.1.0'
    //google services
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.firebase:firebase-core:11.4.2'
    implementation 'com.google.firebase:firebase-messaging:17.1.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    implementation 'com.google.firebase:firebase-crash:15.0.2'
    implementation 'com.google.android.gms:play-services-analytics:15.0.2'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
}

错误:

  Caused by java.lang.ClassNotFoundException
    Didn't find class "com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver" 
on path: DexPathList[[zip file "/data/app/com.karvyclick.fos-1/base.apk"],nativeLibraryDirectories=
[/data/app/com.karvyclick.fos-1/lib/arm, /system/lib, /vendor/lib]]

3 个答案:

答案 0 :(得分:3)

要解决此问题,您必须添加到gradle:

implementation 'com.google.android.gms:play-services-measurement-impl:17.0.0'
implementation 'com.google.android.gms:play-services-ads:18.0.0'

您可以看到来自此link

的评论

答案 1 :(得分:1)

只需将play-services-ads升级到 18.1.1

private static InsnList copy(InsnList insnList) {
    MethodNode mv = new MethodNode();
    insnList.accept(mv);
    return mv.instructions;
}

release note中所述

  • 添加了对 play-services-measurement play-services-measurement-sdk 的依赖。

应用程序不再需要显式添加这些依赖项。

答案 2 :(得分:0)

  

尝试更改Proguard.cfg文件以排除混淆android.gms。*

-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**