我将一个项目从 Eclipse 导入到 Android。然后我在尝试运行应用程序后收到此错误消息:
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 2
好像是这个问题: Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException
但我尝试了所有的答案,但没有一个有效。
这是我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
compileOptions.encoding = 'windows-1251'
defaultConfig {
applicationId "sk.app"
minSdkVersion 15
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.code.gson:gson:2.3'
compile files('libs/activation.jar')
compile files('libs/droidText.0.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/mail.jar')
}
最佳答案
我遇到了这个 ProcessException。据我所知,这主要是由于 64k 方法的限制。这可能是因为您的项目添加了太多的库,这也可能意味着其中很少有重复的。
我遇到的问题是超过了 64k 的限制,因为 PlayServices 包含了重复的依赖项。 ProcessException when buildToolsVersion is changed from 22.0.1 to 23.0.1我的问题在 SOF 中得到解答了吗?
我认为你的情况对我来说似乎不是问题。但是您仍然可以启用 multidex。也可以按照 Building Apps with Over 65K Methods 来做到这一点.
同时尝试最新的构建工具,它是 build-tools 的 23.0.2| .
编辑
对于@EsoRimmer,它不仅可以在启用 MultiDex 的情况下工作,而且最新的构建工具版本也可以使它工作。因此,使用最新的构建工具始终是避免不必要问题的一种方式。
关于android - 错误 :Execution failed for task ':app:dexDebug' after importing project from Eclipse to Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33999588/