I have an error when 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
Try adding the following dependency inside your app's gradle file.
and inside the defaultConfig block enable multiDex support with this
The information in this link may help you supplement the answer.
https://developer.android.com/studio/build/multidex.html?hl=en-419