小编Djo*_*ski的帖子

java.lang.NoClassDefFoundError:com.google.common.base.CharMatcher

我正在尝试在 Lollipop 设备上运行我的应用程序,在 Lollipop 后应用程序运行良好,但是,在 5.0 或更低版本的 Android 中,我的应用程序崩溃并返回此错误:

Process: com.myApp.agr1010, PID: 4353 java.lang.NoClassDefFoundError: com.google.common.base.CharMatcher

但是,我的 Build.Gradle 已经包括MultiDexEnable true

这是我的 Build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.myApp.agr1010"
        minSdkVersion 21
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 3
        versionName "0.8.9-Alpha Release"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation('com.google.guava:guava:29.0-jre')
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1' …
Run Code Online (Sandbox Code Playgroud)

java android gradle build.gradle android-gradle-plugin

5
推荐指数
1
解决办法
3100
查看次数