1

friends, I am developing an android application which has a payment option. I want PayPal integration so I use Braintree direct method with brain tree SDK support but when I add the drop in UI dependency it shows an error.

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

I attach the gradle file below

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 file

 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'
}
Rosemary
  • 1,049
  • 2
  • 11
  • 13

2 Answers2

1

Checkout the response on this question, as i understand you have the same issue:

Unable to merge dex

Hope it helps you

Enable MultiDex:

android {

    defaultConfig {

        // Enabling multidex support.
        multiDexEnabled true
    }

    dexOptions {
        jumboMode true
    }
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
Kaouther Mefteh
  • 132
  • 2
  • 13
0

just use

defaultConfig
            {

                multiDexEnabled true

            }'

in your gradle file

Archu Mohan
  • 199
  • 1
  • 5
  • 14