首页 > 解决方案 > Android:生成主 dex 列表时出错

问题描述

在为 paypal 添加另一个包后,我收到了这个错误,但我已经删除了这个错误,我仍然收到同样的错误,我已经检查了这个问题的几个解决方案,但还没有解决。gradle 代码已附在下面。

Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.

com.android.build.api.transform.TransformException:生成主 dex 列表时出错。

apply plugin: 'com.android.application'


android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "mainproject.mainroject.story"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    aaptOptions
            {
                cruncherEnabled = false
            }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-config:11.0.4'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    implementation 'com.firebaseui:firebase-ui:3.2.2'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.5'
    implementation 'com.paypal.sdk:paypal-android-sdk:2.16.0'
    implementation 'com.craftman.cardform:cardform:0.0.2'
    testImplementation 'junit:junit:4.12'
}
    apply plugin: 'com.google.gms.google-services'

标签: androidandroid-studiogradleandroid-multidex

解决方案


我通过将 minsdkversion 增加到 21 解决了这个问题。希望这会对某人有所帮助


推荐阅读