Android执行失败的任务':应用程序:transformClassesWithDexForAvsDebug'

当我尝试在Android Studio上运行应用程序时,出现此错误:

错误:任务':app:transformClassesWithDexForAvsDebug'的执行失败。 com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'command'C:\ Program Files \ Android \ Android Studio \ jre \ bin \ java.exe''以非零的退出值2结束

joinmultiDexEnabled true没有解决问题。

这些是gradle文件:

的build.gradle(模块:应用):

 apply plugin: 'android-sdk-manager' apply plugin: 'com.android.application' apply plugin: 'jp.leafytree.android-scala' apply plugin: 'android-apt' apply plugin: 'hugo' apply plugin: 'com.mutualmobile.gradle.plugins.dexinfo' apply from: 'config/quality.gradle' repositories { flatDir { dirs 'libs' } } android { //Trigger the licenseFormat task at least once in any compile phase applicationVariants.all { variant -> variant.javaCompiler.dependsOn(rootProject.licenseFormat) } compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { multiDexEnabled true minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode System.getenv("BUILD_NUMBER") as Integer ?: 99999 versionName rootProject.ext.majorVersion + android.defaultConfig.versionCode applicationId "com.waz.zclient" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } packagingOptions { // Need to exclude all armeabi/mips libs // as not all of our libs support these architectures exclude 'lib/armeabi/libgnustl_shared.so' exclude 'lib/armeabi/libspotify_embedded_shared.so' exclude 'lib/armeabi/libspotify_sdk.so' exclude 'lib/mips/librs.blur.so' exclude 'lib/mips/librs.decode.so' exclude 'lib/mips/librsjni.so' exclude 'lib/mips/libRSSupport.so' } testOptions { unitTests.returnDefaultValues = true unitTests.all { // All the usual Gradle options. testLogging { events "passed", "skipped", "failed", "standardOut", "standardError" outputs.upToDateWhen { false } showStandardStreams = true } } } compileOptions { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion } if (file("signing.gradle").exists()) { apply from: 'signing.gradle' } dexOptions { preDexLibraries false javaMaxHeapSize '4g' } buildTypes { release { proguardFiles 'proguard-android-optimize-wire.txt', 'proguard-rules.txt' minifyEnabled true multiDexEnabled true shrinkResources true manifestPlaceholders = [applicationVmSafeMode: "false", localyticsGcmSenderId: "\\ 826316279849"] } debug { // To get debugging properly working again - https://code.google.com/p/android/issues/detail?id=177480 testCoverageEnabled = System.getenv("JOB_NAME").equals("full-test-coverage") versionNameSuffix = " " + getDate() multiDexEnabled true manifestPlaceholders = [applicationVmSafeMode: "true", localyticsGcmSenderId: "\\ 826316279849"] signingConfig signingConfigs.debug } } productFlavors { dev { applicationId "com.waz.zclient.dev" versionName majorVersion + android.defaultConfig.versionCode + "-dev" manifestPlaceholders = [applicationLabel : "Wire Dev", allowBackup : "true", applicationIcon : "@drawable/ic_launcher_wire_dev", sharedUserId : "", use_audio_link : "false", internal_features : "true", localyticsAppKey : getApiKey("localyticsAppKey"), hockeyAppKey : getApiKey("hockeyAppKey")] buildConfigField 'boolean', 'USE_HOCKEY_UPDATE', 'true' buildConfigField 'boolean', 'USE_EDGE_BACKEND', 'true' buildConfigField 'boolean', 'USE_STAGING_BACKEND', 'false' buildConfigField 'boolean', 'SHOW_GRIDOVERLAY', 'true' buildConfigField 'boolean', 'SHOW_DEVELOPER_OPTIONS', 'true' buildConfigField 'boolean', 'IS_LOADTIME_LOGGER_ENABLED', 'true' buildConfigField 'boolean', 'SHOW_TEST_COUNTRY_CODE', 'true' buildConfigField 'boolean', 'SHOW_MENTIONING', 'true' buildConfigField 'boolean', 'IS_TEST_GALLERY_ALLOWED', 'true' buildConfigField 'boolean', 'SHOW_BACKEND_PICKER', 'true' buildConfigField 'int', 'LOG_LEVEL_UI', logLevelWarn() buildConfigField 'int', 'LOG_LEVEL_SE', logLevelSupress() buildConfigField 'int', 'LOG_LEVEL_AVS', logLevelVerbose() patchKeepSpecs() } candidate { applicationId "com.wire.candidate" versionName majorVersion + android.defaultConfig.versionCode + "-candidate" manifestPlaceholders = [applicationLabel : "Wire Candidate", allowBackup : "true", applicationIcon : "@drawable/ic_launcher_wire_candidate", sharedUserId : "", use_audio_link : "false", internal_features : "false", localyticsAppKey : getApiKey("localyticsAppKey"), hockeyAppKey : getApiKey("hockeyAppKeyCand")] buildConfigField 'boolean', 'USE_HOCKEY_UPDATE', 'true' buildConfigField 'boolean', 'USE_EDGE_BACKEND', 'false' buildConfigField 'boolean', 'USE_STAGING_BACKEND', 'true' buildConfigField 'boolean', 'SHOW_GRIDOVERLAY', 'true' buildConfigField 'boolean', 'SHOW_DEVELOPER_OPTIONS', 'true' buildConfigField 'boolean', 'IS_LOADTIME_LOGGER_ENABLED', 'true' buildConfigField 'boolean', 'SHOW_TEST_COUNTRY_CODE', 'true' buildConfigField 'boolean', 'SHOW_MENTIONING', 'false' buildConfigField 'boolean', 'SHOW_ADDRESS_BOOK_INVITATIONS', 'false' buildConfigField 'boolean', 'IS_TEST_GALLERY_ALLOWED', 'true' buildConfigField 'boolean', 'SHOW_BACKEND_PICKER', 'true' buildConfigField 'int', 'LOG_LEVEL_UI', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_SE', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_AVS', logLevelVerbose() } prod { applicationId "com.wire" manifestPlaceholders = [applicationLabel : "@string/app_name", allowBackup : "false", applicationIcon : "@drawable/ic_launcher_wire", sharedUserId : "com.waz.userid", internal_features : "false", use_audio_link : "false", localyticsAppKey : getApiKey("localyticsAppKeyProd"), hockeyAppKey : getApiKey("hockeyAppKeyProd")] buildConfigField 'boolean', 'USE_HOCKEY_UPDATE', 'false' buildConfigField 'boolean', 'USE_EDGE_BACKEND', 'false' buildConfigField 'boolean', 'USE_STAGING_BACKEND', 'false' buildConfigField 'boolean', 'SHOW_GRIDOVERLAY', 'false' buildConfigField 'boolean', 'SHOW_DEVELOPER_OPTIONS', 'false' buildConfigField 'boolean', 'IS_LOADTIME_LOGGER_ENABLED', 'false' buildConfigField 'boolean', 'SHOW_TEST_COUNTRY_CODE', 'false' buildConfigField 'boolean', 'SHOW_MENTIONING', 'false' buildConfigField 'boolean', 'IS_TEST_GALLERY_ALLOWED', 'false' buildConfigField 'boolean', 'SHOW_BACKEND_PICKER', 'false' buildConfigField 'int', 'LOG_LEVEL_UI', logLevelSupress() buildConfigField 'int', 'LOG_LEVEL_SE', logLevelSupress() buildConfigField 'int', 'LOG_LEVEL_AVS', logLevelSupress() } internal { applicationId "com.wire.internal" versionName majorVersion + android.defaultConfig.versionCode + "-internal" proguardFile 'proguard-rules-test.txt' manifestPlaceholders = [applicationLabel : "Wire Internal", allowBackup : "true", applicationIcon : "@drawable/ic_launcher_wire_internal", sharedUserId : "", use_audio_link : "false", gcm_enabled : "false", internal_features: "true", localyticsAppKey : getApiKey("localyticsAppKey"), hockeyAppKey : getApiKey("hockeyAppKeyInternal")] buildConfigField 'boolean', 'USE_HOCKEY_UPDATE', 'false' buildConfigField 'boolean', 'USE_EDGE_BACKEND', 'false' buildConfigField 'boolean', 'USE_STAGING_BACKEND', 'false' buildConfigField 'boolean', 'SHOW_GRIDOVERLAY', 'false' buildConfigField 'boolean', 'SHOW_DEVELOPER_OPTIONS', 'true' buildConfigField 'boolean', 'IS_LOADTIME_LOGGER_ENABLED', 'false' buildConfigField 'boolean', 'SHOW_TEST_COUNTRY_CODE', 'false' buildConfigField 'boolean', 'SHOW_MENTIONING', 'false' buildConfigField 'boolean', 'SHOW_ADDRESS_BOOK_INVITATIONS', 'false' buildConfigField 'boolean', 'IS_TEST_GALLERY_ALLOWED', 'false' buildConfigField 'boolean', 'SHOW_BACKEND_PICKER', 'false' buildConfigField 'int', 'LOG_LEVEL_UI', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_SE', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_AVS', logLevelVerbose() } avs { applicationId "com.wire.avs" versionName majorVersion + android.defaultConfig.versionCode + "-avs" proguardFile 'proguard-rules-test.txt' manifestPlaceholders = [applicationLabel : "Wire AVS", allowBackup : "true", applicationIcon : "@drawable/ic_launcher_wire_playground", sharedUserId : "", use_audio_link : "false", internal_features : "true", localyticsAppKey : getApiKey("localyticsAppKey"), hockeyAppKey : getApiKey("hockeyAppKeyAvs")] buildConfigField 'boolean', 'USE_HOCKEY_UPDATE', 'true' buildConfigField 'boolean', 'USE_EDGE_BACKEND', 'false' buildConfigField 'boolean', 'USE_STAGING_BACKEND', 'false' buildConfigField 'boolean', 'SHOW_GRIDOVERLAY', 'true' buildConfigField 'boolean', 'SHOW_DEVELOPER_OPTIONS', 'true' buildConfigField 'boolean', 'IS_LOADTIME_LOGGER_ENABLED', 'false' buildConfigField 'boolean', 'SHOW_TEST_COUNTRY_CODE', 'false' buildConfigField 'boolean', 'SHOW_MENTIONING', 'false' buildConfigField 'boolean', 'IS_TEST_GALLERY_ALLOWED', 'false' buildConfigField 'boolean', 'SHOW_BACKEND_PICKER', 'true' buildConfigField 'int', 'LOG_LEVEL_UI', logLevelSupress() buildConfigField 'int', 'LOG_LEVEL_SE', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_AVS', logLevelVerbose() } qaavs { applicationId "com.wire.qaavs" versionName majorVersion + android.defaultConfig.versionCode + "-qaavs" proguardFile 'proguard-rules-test.txt' manifestPlaceholders = [applicationLabel : "Wire QA AVS", allowBackup : "true", applicationIcon : "@drawable/ic_launcher_wire_playground", sharedUserId : "", use_audio_link : "false", internal_features : "true", localyticsAppKey : getApiKey("localyticsAppKey"), hockeyAppKey : getApiKey("hockeyAppKeyQaavs")] buildConfigField 'boolean', 'USE_HOCKEY_UPDATE', 'true' buildConfigField 'boolean', 'USE_EDGE_BACKEND', 'false' buildConfigField 'boolean', 'USE_STAGING_BACKEND', 'false' buildConfigField 'boolean', 'SHOW_GRIDOVERLAY', 'true' buildConfigField 'boolean', 'SHOW_DEVELOPER_OPTIONS', 'true' buildConfigField 'boolean', 'IS_LOADTIME_LOGGER_ENABLED', 'false' buildConfigField 'boolean', 'SHOW_TEST_COUNTRY_CODE', 'true' buildConfigField 'boolean', 'SHOW_MENTIONING', 'false' buildConfigField 'boolean', 'SHOW_ADDRESS_BOOK_INVITATIONS', 'false' buildConfigField 'boolean', 'IS_TEST_GALLERY_ALLOWED', 'true' buildConfigField 'boolean', 'SHOW_BACKEND_PICKER', 'true' buildConfigField 'int', 'LOG_LEVEL_UI', logLevelSupress() buildConfigField 'int', 'LOG_LEVEL_SE', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_AVS', logLevelVerbose() } experimental { applicationId "com.wire.x" versionName majorVersion + android.defaultConfig.versionCode + "-exp" proguardFile 'proguard-rules-test.txt' manifestPlaceholders = [applicationLabel : "Wire Exp", allowBackup : "true", applicationIcon : "@drawable/ic_launcher_wire_playground", sharedUserId : "", use_audio_link : "false", internal_features : "true", localyticsAppKey : getApiKey("localyticsAppKey"), hockeyAppKey : getApiKey("hockeyAppKeyExperimental")] buildConfigField 'boolean', 'USE_HOCKEY_UPDATE', 'true' buildConfigField 'boolean', 'USE_EDGE_BACKEND', 'false' buildConfigField 'boolean', 'USE_STAGING_BACKEND', 'false' buildConfigField 'boolean', 'SHOW_GRIDOVERLAY', 'true' buildConfigField 'boolean', 'SHOW_DEVELOPER_OPTIONS', 'true' buildConfigField 'boolean', 'IS_LOADTIME_LOGGER_ENABLED', 'true' buildConfigField 'boolean', 'SHOW_TEST_COUNTRY_CODE', 'true' buildConfigField 'boolean', 'SHOW_MENTIONING', 'true' buildConfigField 'boolean', 'IS_TEST_GALLERY_ALLOWED', 'true' buildConfigField 'boolean', 'SHOW_BACKEND_PICKER', 'true' buildConfigField 'int', 'LOG_LEVEL_UI', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_SE', logLevelVerbose() buildConfigField 'int', 'LOG_LEVEL_AVS', logLevelVerbose() patchKeepSpecs() } } sourceSets { androidTest { java.srcDirs += ['build/generated/source/apt/androidTest/dev/debug'] } test { scala.srcDirs += ['src/test/scala'] } } /* to ignore error where multiple libs have this file */ packagingOptions { exclude 'META-INF/services/javax.annotation.processing.Processor' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' exclude 'APK_LICENSE.txt' exclude 'LICENSE.txt' } } def patchKeepSpecs() { def taskClass = "com.android.build.gradle.internal.tasks.multidex.CreateManifestKeepList"; def clazz = this.class.classLoader.loadClass(taskClass) def keepSpecsField = clazz.getDeclaredField("KEEP_SPECS") keepSpecsField.setAccessible(true) def keepSpecsMap = (Map) keepSpecsField.get(null) if (keepSpecsMap.remove("activity") != null) { println "KEEP_SPECS patched: removed 'activity' root" } else { println "Failed to patch KEEP_SPECS: no 'activity' root found" } if (keepSpecsMap.remove("instrumentation") != null) { println "KEEP_SPECS patched: removed 'instrumentation' root" } else { println "Failed to patch KEEP_SPECS: no 'instrumentation' root found" } if (keepSpecsMap.remove("service") != null) { println "KEEP_SPECS patched: removed 'service' root" } else { println "Failed to patch KEEP_SPECS: no 'service' root found" } } afterEvaluate { //Pretty big hack to keep the main dex class list down Task collectTask = project.tasks.findByName("collectDevDebugMultiDexComponents") Task processManifestTask = project.tasks.findByName("processDevDebugManifest") if (!collectTask || !processManifestTask) return collectTask.dependsOn(processManifestTask) << { File androidManifestFile = processManifestTask.outputs.files.filter { it.absolutePath.matches('.*full.*AndroidManifest\\.xml') }.singleFile File manifestKeepFile = collectTask.outputs.files.filter { it.absolutePath.endsWith('manifest_keep.txt') }.singleFile def nonExportedClasses = new XmlSlurper().parse(androidManifestFile).application.'**'.findAll { node -> if (node.name().matches('(activity|service|receiver|provider)')) { return (node.'@android:exported' == 'false' || (node.'@android:exported' != 'true' && node.'intent-filter'.size() == 0)) } }.collect { it.'@android:name'.text() } def manifestKeepText = manifestKeepFile.text manifestKeepFile.withWriter('utf-8') { writer -> manifestKeepText.eachLine { line -> boolean isNonExportedLine = nonExportedClasses.any { line.contains(it) } if (!isNonExportedLine) writer.writeLine(line) } } } } dexinfo { maxDepth 2 } dependencies { compile project(':wire-core') compile project(':wire-ui') compile project(':lintlib') // compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:multidex:1.0.1' compile deps.scala compile deps.multidex compile deps.supportv4 compile deps.supportv13 compile deps.supportdesign compile deps.appcompatv7 compile deps.supportannotations compile deps.recyclerview compile deps.threetenabp compile deps.hockey compile deps.audioNotifications compile deps.localytics compile deps.roundedimageview compile deps.rebound // For spotify compile deps.spotifyAuth // For Video Message preview compile deps.mp4parser //noinspection GradleDynamicVersion compile deps.psBase compile deps.psGcm compile deps.psMaps compile deps.psLocation compile deps.cardview //Used for animating incoming messages compile deps.nineoldandroids // For using local files in app/libs //compile (name:'avs', ext:'aar') //compile (name:'audio-notifications', ext:'aar') //compile (name:'zmessaging-android', ext:'aar') // Test dependencies testCompile deps.junit testCompile(deps.testutils) { exclude module: 'aspectjrt' exclude module: 'isoparser' exclude module: 'zmessaging-android' } testCompile(deps.scalatest) { exclude module: 'scala-library' } testCompile deps.espressoIntents testCompile deps.hamcrestCore testCompile deps.hamcrestLib testCompile deps.hamcrestIntegration testCompile deps.mockitoCore testCompile deps.espresso testCompile deps.supportannotations //AndroidTest dependencies //androidTestCompile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile deps.junit androidTestCompile deps.espressoIntents androidTestCompile deps.testRunner androidTestCompile deps.testRules androidTestCompile deps.espresso androidTestCompile deps.supportannotations androidTestCompile deps.mockitoCore androidTestCompile deps.dexmaker androidTestCompile deps.dexmakerDx androidTestCompile deps.dexmakerMockito //Translations compile deps.translations } tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = ["-feature", "-target:jvm-1.7", "-Xfuture", "-deprecation", "-Yinline-warnings", "-Ywarn-unused-import", "-encoding", "UTF-8"] } def getDate() { def date = new Date() def formattedDate = date.format('MM/dd HH:mm:ss') return formattedDate } def getApiKey(String property) { if (file("$projectDir/api-keys.properties").exists()) { Properties properties = new Properties() properties.load(new FileInputStream("$projectDir/api-keys.properties")) return properties.getProperty(property) } else if (property.startsWith("localytics")) { return "00000000000000000000000-00000000-0000-0000-0000-000000000000" } else { return java.util.UUID.randomUUID().toString().replaceAll("-", "") } } // Same values as in log_levels.xml // (workaround for R not being available in BuildConfig for test flavor) def logLevelVerbose() { return '2' } def logLevelDebug() { return '3' } def logLevelInfo() { return '4' } def logLevelWarn() { return '5' } def logLevelError() { return '6' } def logLevelSupress() { return '99' } 

的build.gradle(模块:丝核):

 apply plugin: 'com.android.library' apply plugin: 'com.neenbedankt.android-apt' apply from: "${project.rootDir}/app/config/quality.gradle" android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion dexOptions { preDexLibraries false javaMaxHeapSize '4g' } defaultConfig { multiDexEnabled true minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile deps.appcompatv7 compile deps.timber // TODO Nasty hack to be able to build add only one wire-core flavor to the build // TODO (I know, it sucks, will think of a better way to do this, and we need this // TODO when there are different SE APIs in dev vs internal/prod) boolean dev = true; boolean internal = false; boolean prod = false; for (String taskName : gradle.startParameter.taskNames) { if (taskName.contains("Dev")) { dev = true; break; } if (taskName.contains("Internal") || taskName.contains("Experimental") || taskName.contains("Qaavs") || taskName.contains("Avs")) { internal = true; dev = false; break; } if (taskName.contains("Prod") || taskName.contains("Candidate")) { prod = true; dev = false; break; } } def avs_artifact = "$avsGroup:$avsName"; def avs_version = avsInternalVersion; def se_version = zMessagingReleaseVersion; if (dev) { avs_version = avsInternalVersion; se_version = zMessagingDevVersion; } if (internal) { avs_version = avsInternalVersion; se_version = zMessagingDevVersion; } if (prod) { avs_version = avsVersion; } compile "$avs_artifact:$avs_version" compile("com.wire:zmessaging-android:$se_version") { transitive = true } } 

的build.gradle(模块:线UI):

 apply plugin: 'com.android.library' apply from: "${project.rootDir}/app/config/quality.gradle" apply plugin: 'hugo' android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion dexOptions { preDexLibraries false javaMaxHeapSize '4g' } defaultConfig { multiDexEnabled true minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile deps.appcompatv7 compile(deps.supportpreferences) { exclude group: 'com.android.support', module: 'appcompat-v7' } compile deps.supportannotations compile deps.roundedimageview compile deps.timber compile deps.recyclerview compile project(':wire-core') compile deps.threetenabp compile deps.supportdesign compile deps.preferences compile(deps.supportpreferences) { exclude group: 'com.android.support', module: 'appcompat-v7' } compile deps.rebound androidTestCompile deps.testRunner androidTestCompile deps.testRules androidTestCompile deps.espresso } 

Solutions Collecting From Web of "Android执行失败的任务':应用程序:transformClassesWithDexForAvsDebug'"

这将发生这些原因

  1. 如果您的项目中包含一大组库。
  2. 如果你包含的库不兼容,或与应用程序不兼容(如在应用程序中,如果你包括android support-v4.jar和一个使用androiddevise支持库的库。
  3. 您可能已经在您的应用程序中打了65k个方法。
  4. 有时候,如果你正在运行应用程序的设备没有足够的RAM,就会发生这种情况。

如果你的问题是1或3

随着multiDexEnabled true添加dexOptions内的android块帮助我

 dexOptions { preDexLibraries = false incremental true javaMaxHeapSize "4g" } 

如果你正在运行unit testing,添加MultiDex.install(this); 在你的Application类的onCreate()方法中

  1. 重新启动Android工作室。
  2. 清理项目。
  3. 再次构build它。

如果选项2是你的问题,那么你必须删除该库,清理项目和生成了

您需要遵循这些步骤

就像你已经做的那样

  defaultConfig { ... ... multiDexEnabled true } 

编译'com.android.support:multidex:1.0.1'

在你的AndroidManifest.xml中添加这行android:name

 <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" android:name="android.support.multidex.MultiDexApplication" > 

并在你的build.gradle也添加

 dexOptions { //incremental = true; preDexLibraries = false javaMaxHeapSize "4g" } 

如果你正在使用这样的东西

  compile 'com.android.support:support-v4:22.2.0' 

比你每个人都用这个尝试排除模块来支持版本

  compile ('com.android.support:support-v4:22.2.0') { exclude module: 'support-v4' } 

而且,如果你编译这样的jar文件编译

  compile files('libs/yourjar.jar') 

除去这个或评论

  compile fileTree(dir: 'libs', include: ['*.jar']) 

不幸的是没有答案工作,在我的情况下,要查看—>工具窗口—>生成变种,然后更改应用程序的构build变种从AvsDebug到DevDebug解决了这个问题。