【问题标题】:How to fix " java.lang.NoClassDefFoundError: com/android/tools/r8/com/google/common/collect/ImmutableMultiset" error如何修复“java.lang.NoClassDefFoundError:com/android/tools/r8/com/google/common/collect/ImmutableMultiset”错误
【发布时间】:2019-12-04 21:33:46
【问题描述】:

将我的 android studio 和 gradle 插件升级到最新版本后,我尝试构建我的项目 apk,但出现此错误“原因:com/android/tools/r8/com/google/common/collect/ImmutableMultiset”,我迷路了,在谷歌搜索中找不到与“ImmutableMultiset”相关的任何内容。有谁能帮帮我吗?

我尝试过无效缓存,但没有解决..

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.3.0'
        classpath 'io.fabric.tools:gradle:1.29.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "com.talkbiz.naijaexamspreparations"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
            pseudoLocalesEnabled false
            zipAlignEnabled true
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:support-core-utils:28.0.0"
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0-alpha08'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.google.firebase:firebase-firestore:20.2.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-beta01'
    implementation 'com.github.antonKozyriatskyi:CircularProgressIndicator:1.3.0'
    implementation 'com.maltaisn:calcdialog:1.4.1'
    implementation 'com.facebook.android:facebook-login:[5,6)'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'de.psdev.formvalidations:formvalidations:1.2.0'
    implementation 'com.firebaseui:firebase-ui-firestore:5.0.0'
    implementation 'androidx.paging:paging-runtime:2.1.0'
    implementation 'io.supercharge:shimmerlayout:2.1.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
}
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 如果我无法解决我的问题,我只是删除并重新安装 android studio,而不是寻找几天的解决方案。正如my answer here 中提到的那样,不会花费太长时间。
  • @TamirAbutbul Haaa,删除并重新安装??
  • 你能添加你的build.gradle吗,我认为你必须添加番石榴依赖
  • @Ahmed.ess build.gradle 项目或模块?
  • @Ahmed.ess 我已经添加了我的 build.gradle

标签: android android-studio build


【解决方案1】:

我通过以下步骤解决了这个问题:

  1. 转到“C:\Users{username}.gradle\caches”文件夹
  2. 并删除所有文件。
  3. 那就试试吧

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-16
    • 2020-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-12
    相关资源
    最近更新 更多