Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in Android Studio when running my application [duplicate]

Tags:

java

android

I am trying to work on new app on android studio, i used to work on e

 UNEXPECTED TOP-LEVEL EXCEPTION:
  com.android.dex.DexIndexOverflowException: method ID not in [0,          
  0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:484)
at    com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261)
   Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
 com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

What could this error be?

i have moved some jar files to my eclipse. and my build.gradle is like this

   apply plugin: 'com.android.application'
     android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
    applicationId "com.netvariant.heinz"
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
    }
}}dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'}
like image 679
user3278732 Avatar asked Nov 27 '22 08:11

user3278732


1 Answers

I think your dex file is reached to its maximum method count. Try to use

multiDexEnabled true

in your deafault config or try to minmize your playservices from your dependencies. Use only required packages. Try changing your version or exclude unwanted packages

like image 131
MaxExplode Avatar answered Dec 05 '22 16:12

MaxExplode