Error creating apk android studio [duplicated]

-1

When trying to create the apk (Build > Build APK) , the following error occurs:

  

Error: Execution failed for task   ': app: transformClassesWithDexForDebug'.    com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:   java.util.concurrent.ExecutionException:   com.android.dex.DexIndexOverflowException: method ID not in [0,   0xffff]: 65536

Does anyone have any idea how to solve this error?

Gradle app code

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.sunami.work"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    compile files('libs/mail.jar')
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.google.android.gms:play-services:10.0.1'
    testCompile 'junit:junit:4.12'
}
    
asked by SpartanDev 06.02.2017 в 17:44
source

1 answer

1

It usually happens that while we are building our application we are adding more and more libraries, and therefore our app reaches a peak then you must enable the multiDexEnabled to true

defaultConfig {
        ...
        multiDexEnabled true
    }
dependencies {
  ...
  compile 'com.android.support:multidex:1.0.+'
}

Learn more

    
answered by 06.02.2017 / 18:09
source