【问题标题】:Caused by java.lang.ClassNotFoundException Didn't find class "com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver由 java.lang.ClassNotFoundException 导致找不到类“com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver
【发布时间】:2019-08-19 18:05:51
【问题描述】:

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

谁能帮我解决这个问题

分级:

   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]]

【问题讨论】:

  • 使用 proguard 吗?
  • buildTypes { debug { minifyEnabled false useProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules_new.pro' } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt' ), 'proguard-rules_new.pro' } }
  • @Redman 请检查,我上面的评论
  • proguard 已关闭。你在使用多索引吗?
  • 是的,我正在使用 multidex

标签: java android


【解决方案1】:

要解决这个问题,你必须添加到 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看到cmets

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      【解决方案3】:

      只需将播放服务广告升级到 18.1.1

      implementation 'com.google.android.gms:play-services-ads:18.1.1'
      

      release note中所述

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-11-28
        • 2021-08-30
        • 2019-05-11
        • 2018-04-04
        • 2019-09-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多