生成Android项目时添加dexdebug错误

生成Android项目时添加dexdebug错误,android,gradle,Android,Gradle,Gradle生成控制台正在显示此消息 Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin

Gradle生成控制台正在显示此消息

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
我被告知此问题是由于build.gradle文件上的错误设置造成的。我的gradle文件看起来像这样

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"

defaultConfig {
    applicationId "com.marshall.gruppo"
    minSdkVersion 15
    targetSdkVersion 22
    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:appcompat-v7:22.2.0'
compile project(':volley')
compile project(':android-support-v4')
}

我应该在这里修复什么?

将其放入您的构建中。gradle:

android {
...
  defaultConfig {
    ...
    multiDexEnabled true
    ...
  }
...
}
...
dependencies {
   ...
   compile 'com.android.support:multidex:1.0.1'
   ...
}
并将其放入您的AndroidManifest.xml中:

<application
...
android:name="android.support.multidex.MultiDexApplication"
...>


查看:@hareshchelana感谢您的反馈。我遵循了这个建议,现在它显示出另一个错误!错误:任务“”的执行失败:应用程序:PackageAllDebugClassesForMultiIndex'>java.util.zip.ZipException:duplicate entry:android/support/v4/internal/view/SupportMenu.classUpdate您的问题以反映这个新问题,这样您就更有可能找到答案将apk放在这个链接上,并检查方法数是否超过65k。我认为你的apk有超过65k的方法