-1

I am stuck with this error for 2 days.

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

Here is the gradle file:

apply plugin: 'com.android.application'

   android
 {

  compileSdkVersion 26
    buildToolsVersion "26.0.2"
useLibrary 'org.apache.http.legacy'


defaultConfig {
    applicationId "com.example.pos"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
//        multiDexEnabled true

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'LICENSE.txt'
    exclude 'asm-license.txt'
    exclude 'META-INF/ASL2.0'

 }    }

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'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
//    compile files('libs/gson-2.2.2.jar')
compile files('libs/picasso-2.0.0.jar')
compile files('libs/upg_bridge.jar')
compile files('libs/log4j-1.2.16.jar')
compile files('libs/posindev.jar')
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.google.code.gson:gson:2.7'
//    compile 'com.google.android.gms:play-services-base:10.2.0'
compile 'com.google.android.gms:play-services-base:10.2.1'

compile 'com.jakewharton.timber:timber:4.5.1'
compile project(':commerce-driver-uat-2.27.0.157')
compile project(':ingenico-uat-2.27.0.157')
//    compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup:otto:1.3.5'
compile 'com.squareup.okhttp:okhttp:2.7.4'
compile 'com.squareup.okhttp:okhttp-ws:2.7.4'
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.4'
compile 'com.couchbase.lite:couchbase-lite-android:1.4.0'
compile 'com.couchbase.lite:couchbase-lite-android-forestdb:1.4.0'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile project(':mpos.android.accessories.miura-2.25.0')
compile project(':mpos.android.comlinks.tcp-2.25.0')
compile project(':mpos.android.comlinks.bluetooth-2.25.0')
compile project(':mpos.android.core-2.25.0')
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
//    compile 'com.google.android.gms:play-services:11.0.4'
  } 

If I do not add multidex then it won't generate apk. And if I add multidex it shows error in another class, like it won't be able to import some default classes. It says class not found. And those classes I am getting from a module imported in my project. I don't get what's the issue. Thanks in advance.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
Shuchi Sheth
  • 219
  • 2
  • 13

1 Answers1

0

Add this line in your gradle file and then clean the project and run application

android {
...
defaultConfig {
    ...
    multiDexEnabled true
    }
}
Muhammad Tufail
  • 326
  • 5
  • 14