Error in Android Studio when starting the application

I am trying to work on a new application in Android studio, I was working 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 be this mistake?

I moved some jar files to my eclipse. and my build.gradle looks 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'}
+4
source share
1 answer

I think your dex file has reached the maximum number of methods. Try using

multiDexEnabled true

in your deafault configuration or try to minimize your services from your dependencies. Use only necessary packages. Try changing the version or excluding unwanted packages

+30
source

Source: https://habr.com/ru/post/1629390/


All Articles