运行我的应用程序时Android Studio出错[重复]

时间:2022-01-07 20:22:28

This question already has an answer here:

这个问题在这里已有答案:

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

我正在努力研究android studio上的新应用程序,我曾经在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

我已经将一些jar文件移动到了我的日食中。而我的build.gradle就是这样的

   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'}

1 个解决方案

#1


30  

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

我认为你的dex文件达到了它的最大方法数。尝试使用

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

在你的deafault配置中或尝试从你的依赖项中最小化你的playservices。仅使用必需的包。尝试更改您的版本或排除不需要的包

#1


30  

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

我认为你的dex文件达到了它的最大方法数。尝试使用

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

在你的deafault配置中或尝试从你的依赖项中最小化你的playservices。仅使用必需的包。尝试更改您的版本或排除不需要的包