Error generating apk [duplicate]

0

I have an error to the general my apk, my gradle is the following:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.taxiconductor"
        minSdkVersion 16
        targetSdkVersion 25
        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(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'

    testCompile 'junit:junit:4.12'
    compile 'junit:junit:4.12'
}
  

23:32:25 Executing tasks: [: app: assembleDebug] 23:37:11 Gradle build   finished with 1 error (s) in 4m 44s 524ms 23:37:12 Build APK: Errors   while building APK. You can find the errors in the 'Messages' view.   23:57:23 Gradle sync started

> 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
    
asked by Carlos Hernández 26.02.2017 в 06:47
source

1 answer

1

Try adding the following dependency within the gradle file of your app.

 com.android.support:multidex:1.0.0

and inside the defaultConfig block enables multiDex support with this

 multiDexEnabled true

The information on this link may help you complement the answer.

link

    
answered by 26.02.2017 / 07:10
source