错误:任务&#39的执行失败:app:dexDebug'从Eclipse导入项目到Android Studio之后 [英] Error:Execution failed for task ':app:dexDebug' after importing project from Eclipse to Android Studio

查看:53
本文介绍了错误:任务&#39的执行失败:app:dexDebug'从Eclipse导入项目到Android Studio之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Eclipse导入了一个项目到Android.然后,我尝试运行应用程序后收到以下错误消息:

I imported a project from Eclipse to Android. Then I get this error message after I tried to run application:

错误:任务':app:dexDebug'执行失败.com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'command'C:\ Program Files(x86)\ Java \ jdk1.8.0_40 \ bin \ java.exe''已完成退出值为2的非零值

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

似乎是这个问题:错误:任务':app:dexDebug'执行失败.com.android.ide.common.process.ProcessException

但是我尝试了所有答案,但没有一个起作用.

But I tried all of the answers and none of them worked.

这是我的build.gradle

Here is my 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方法的限制.发生这种情况的原因是您的项目添加了太多的库,这也意味着它们很少是重复的.

I had this ProcessException.From what I have seen it is mainly due to the 64k method limitation. This may occur because your project has so many libraries added which may also mean that few of them are duplicate.

问题是由于PlayServices包含重复的依存关系,因此我的限制超过了64k.当从buildToolsVersion更改为 ProcessException时我在SOF中回答了22.0.1至23.0.1 的问题.

Issue I had was 64k limitation crossed because of duplicate dependencies included through PlayServices. ProcessException when buildToolsVersion is changed from 22.0.1 to 23.0.1 is my issue answered in SOF.

在您的情况下,我认为这对我来说似乎不是问题.但是仍然可以启用multidex.通过遵循使用超过65K的方法构建应用程序,也可以做到这一点.

I think in your case that does not seem to be an issue for me. But still you can have multidex enabled. Do that too by following Building Apps with Over 65K Methods.

尝试使用最新的构建工具版本,该版本来自 编辑

对于@EsoRimmer,它不能仅在启用MultiDex的情况下工作,而是要使用最新的构建工具版本.因此,始终使用最新的构建工具来避免不必要的问题.

For @EsoRimmer, it did not work just with MultiDex enabled but latest build tools version along with it made it work. So, using the latest build tools always a way to avoid unnecessary issues.

这篇关于错误:任务&#39的执行失败:app:dexDebug'从Eclipse导入项目到Android Studio之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆