我无法构建项目的 apk 文件,每当我尝试构建时都会收到此错误。 dexBuilder调试失败

问题描述 投票:0回答:1

I am getting this error while trying to build the APK file of the project.

这是我的 Gradle 文件

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
    compileSdkVersion 34

    defaultConfig {
        applicationId ""
        minSdkVersion 21
        targetSdkVersion 34
        versionCode 1
        versionName "1.0.0"
        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }


}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])





    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'androidx.recyclerview:recyclerview:1.3.2'


    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.material:material:1.11.0'

    //okhttp logging interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'

    //Retrofit Library
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

    implementation 'io.github.shashank02051997:FancyToast:2.0.2'


    //External Libraries-------------------

    implementation 'io.realm:android-adapters:1.4.0'
    implementation 'com.github.ceryle:RadioRealButton:v1.3'
    implementation 'com.yarolegovich:lovely-dialog:1.1.1'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
}

我尝试了 Stack Over Flow 中的所有解决方案,但无法找到原因,有人可以解释一下为什么我会收到此错误以及解决方案是什么吗?

java android gradle android-gradle-plugin android-multidex
1个回答
0
投票

通过查看随附的屏幕截图

我认为这可能是因为默认情况下(gradle.properties

android.enableR8.fullMode=true
使其
android.enableR8.fullMode=false
并尝试它会创建APK

© www.soinside.com 2019 - 2024. All rights reserved.