从Eclipse导入到Android Studio之后无法运行执行失败的任务“:应用程序:dexDebug" [英] After import from Eclipse to Android Studio cannot run Execution failed for task ':app:dexDebug"

查看:520
本文介绍了从Eclipse导入到Android Studio之后无法运行执行失败的任务“:应用程序:dexDebug"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个Android项目在Eclipse(4.4.2)ADT工作,在Linux(Ubuntu的14.10)上运行。

我已导入到Android工作室(1.1.0),并设法摆脱我最初的编译错误。

我要到D的下一件事就是到我的手机上运行 - 我推绿色的运行按钮,过一小会儿我得到一个错误(这显示不出来的时候我只是建立模块,只有当我尝试运行)

错误是这样的:


  

错误:执行失败的任务:的myapp:dexDebug。
  com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程命令/ usr / lib目录/ JVM / Java的7-的OpenJDK,AMD64 /斌/ java的''与非完零退出值2


一直在寻找通过SO最后4小时,没有发现任何东西,这似乎与我的项目。难道还有其他的地方,我可以去找找一个更有用的错误?

编辑: Aaarghh - 只是重建整个项目(而不是信任导入向导) - 我创建了一个新的Andr​​oid Studio项目,引进我的code和资源,然后解决所有的编译和依赖错误。拨通了一个清晰的版本,然后试图逃跑....同样谴责的错误!一模一样。我在做什么错误????

公布,以供参考新的build.gradle:

  buildscript {
库{
    行家{URLhttps://maven.fabric.io/public'}
}依赖{
    类路径'io.fabric.tools:gradle:1.+
}
}
应用插件:'com.android.application
应用插件:'io.fabric安卓{
compileSdkVersion 21
buildToolsVersion21.1.1defaultConfig {
    的applicationIDcom.mycompany.app_Name
    15的minSdkVersion
    targetSdkVersion 21
    版本code 1
    的versionName1.0
}
buildTypes {
    发布 {
        minifyEnabled假
        proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
    }
}
}库{mavenCentral()
    行家{URLhttps://maven.fabric.io/public'}}依赖{
编译文件树(导演:'库',包括:['的* .jar'])
编译com.actionbarsherlock:actionbarsherlock:4.4.0@aar
编制项目(':swipeListView')
编译com.sothree.slidinguppanel:库:3.0.0
编译文件(库/ volley.jar')
编译文件(库/ libGoogleAnalyticsServices.jar')
编译文件(库/ commons- codeC-1.8.jar')
编译文件(库/ LinkedIn-J-的android.jar')
编译文件(库/路标-commonshttp4-1.2.1.1.jar')
编译文件(库/路标核-1.2.1.1.jar')
编译文件(库/ twitter4j核-4.0.1.jar')
编译文件(库/ core.jar添加')
编译文件(库/ gcm.jar')
编译com.google.android.gms:游戏服务:87年6月5日
编译com.facebook.android:facebook-android-sdk:3.20.0
编译('com.crashlytics.sdk.android:crashlytics:2.2.2@aar'){
    传递= TRUE;
}
编制项目(':myImportedProject')
}

也试过导出为我的密钥库的APK:有一个类似的错误:


  

错误:执行失败的任务:应用程序:dexRelease。
  com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程命令/ usr / lib目录/ JVM / Java的7-的OpenJDK,AMD64 /斌/ java的''与非完零退出值2



解决方案

啊哈!

好像答案是进一步向上的曲线:错误是


  

com.android.dex.DexException:多DEX文件定义LCOM / nineoldandroids /动画/动画$ AnimatorListener;


于是,我找到了答案在这里:

<一个href=\"http://stackoverflow.com/questions/24414318/listviewanimations-library-causes-top-level-exception\">ListViewAnimations图书馆原因TOP-LEVEL-EXCEPTION

的伎俩之一就是不仅要添加行的build.gradle说

 编译文件(库/ nineoldandroids-2.4.0.jar')

也从库目录中删除JAR。

现在我有更多的连接问题,但我会留下来的另一个问题,我猜。

Have an Android project working in Eclipse (4.4.2) ADT, running on Linux (Ubuntu 14.10).

I have imported to Android Studio (1.1.0) and managed to get rid of my initial compilation errors.

The next thing I want to d is to run on my phone - I push the green "Run" button and after a little while I get an error (this doesn't show up when I just build module, only when I try to run)

The error is this:

Error:Execution failed for task ':myapp:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2

Been looking through SO for the last 4 hours and not found anything that seems relevant to my project. Is there another place I can look to find a more useful error?

EDIT: Aaarghh - just recreated the entire project(rather than trusting the import wizard) - I created a new Android Studio project, imported my code and resources and then solved all the compilation and dependency errors. Got through to a clear build then tried to run....same damn error! Exactly the same. What am I doing wrong????

New build.gradle posted for reference:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
    applicationId "com.mycompany.app_Name"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

repositories { mavenCentral()
    maven { url 'https://maven.fabric.io/public' } }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile project(':swipeListView')
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile files('libs/volley.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/commons-codec-1.8.jar')
compile files('libs/linkedin-j-android.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
compile files('libs/core.jar')
compile files('libs/gcm.jar')
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.facebook.android:facebook-android-sdk:3.20.0'
compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
    transitive = true;
}
compile project(':myImportedProject')
}

Also tried to export as an APK with my keystore: got a similar error:

Error:Execution failed for task ':app:dexRelease'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2

解决方案

Aha!

Seems the answer was further up in trace: The error was

com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;

So I found the answer here:

ListViewAnimations Library Causes TOP-LEVEL-EXCEPTION

Part of the trick is not only to add the line to build.gradle saying

compile files('libs/nineoldandroids-2.4.0.jar')

but also to remove the JAR from the libs directory.

Now I have more linking issues but I'll leave them for another question I guess.

这篇关于从Eclipse导入到Android Studio之后无法运行执行失败的任务“:应用程序:dexDebug&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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