在Android中添加ui依赖的脑树下降时,dex文件无法合并

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

朋友们,我正在开发一个有付款选项的Android应用程序。我想要PayPal集成,所以我使用Braintree直接方法和脑树SDK支持,但是当我添加UI依赖关系时,它会显示错误。

Error:Execution failed for 
 task:app:transformDexArchiveWithExternalLibsDexMergerForDebug.
    > java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

我附上下面的gradle文件

dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        testImplementation 'junit:junit:4.12'
        implementation 'com.braintreepayments.api:braintree:2.+'
        implementation 'com.braintreepayments.api:drop-in:3.0.0'
    }

build.gradle文件

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        multiDexEnabled true
        applicationId "com.stunntech.paypalandroid"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.braintreepayments.api:braintree:2.4.0'
   // implementation 'com.braintreepayments.api:drop-in:3.0.5'
}
android paypal braintree
2个回答
1
投票

检查这个问题的回复,因为我知道你有同样的问题:

Unable to merge dex

希望它能帮到你

启用MultiDex:

android {

    defaultConfig {

        // Enabling multidex support.
        multiDexEnabled true
    }

    dexOptions {
        jumboMode true
    }
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}

0
投票

只是用

defaultConfig
            {

                multiDexEnabled true

            }'

在你的gradle文件中

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