“命令行太长"dexDebugTest 构建任务中的错误 [英] "The command line is too long" error in dexDebugTest build task

查看:31
本文介绍了“命令行太长"dexDebugTest 构建任务中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照此链接在 Android Studio 中设置测试用例:

I followed this link to set up test cases in Android Studio:

但是如果我尝试在我的项目中运行一些测试,我会收到以下错误:

But if I try to run some tests in my project I get the following error:

**Execution failed for task ':common_lib_app:dexDebugTest'.**
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Program Files (x86)\Android\android_studio\sdk\build-tools\19.1.0\dx.bat --dex --num-threads=4 --output D:\Android\android_studio\

update error:

The command line is too long.

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':commom_lib_app:dexDebugTest'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Program Files (x86)\Android\android_studio\sdk\build-tools\19.1.0\dx.bat --dex --num-threads=4 --output D:\Android\android_studio\app\Delivery\25-11-14\app\commom_lib_app\build\intermediates\dex\test\debug D:\Android\android_studio\app\Delivery\25-11-14\app\commom_lib_app\build\intermediates\classes\test\debug D:\Android\android_studio\app\Delivery\25-11-14\app\commom_lib_app\build\intermediates\dependency-cache\test\debug D:\Android\android_studio\app\Delivery\25-11-14\app\commom_lib_app\build\intermediates\pre-dexed\test\debug\android-viewbadger-9d48585bb36d47b79a1e72c63063924a4680e127.jar D:\Android\android_studio\app\Delivery\25-11-14\app\commom_lib_app\build\intermediates\pre-dexed\test\debug\annotations-12.0-74efc7d81ba4e593d47bf812f81a6e79e66e3a94.jar D:\Android\android_studio\app\Delivery\25-11-14\app\commom_lib_app\intermediates\pre-dexed\test\debug\apktool-lib-1.4.4-3-e106601b170eeb66eba64dc7a8f7b456d516b9f3.jar D:\Android\android_studio\app\Delivery\25-11-14\app\commom_lib_app\build\intermediates\pre-dexed\test\debug\bolts-

我有多个具有公共库类的项目(即 ==common_lib_app).

I have multiple projects with a common library class (i.e ==common_lib_app).

这是我的build.gradle:

 androidTestCompile('junit:junit:4.11') {
  exclude group: 'org.hamcrest', module: 'hamcrest-library'
    }
    androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
    androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.2.1'
    androidTestCompile 'org.mockito:mockito-core:1.9.5'
    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
    androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
    compile 'com.github.tony19:logback-android-core:1.1.1-2'
    compile 'com.github.tony19:logback-android-classic:1.1.1-2'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
    compile 'com.squareup.okhttp:okhttp:1.5.4'
    compile 'de.greenrobot:eventbus:2.2.1'
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.android.support:gridlayout-v7:20.0.0'
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.commonsware.cwac:endless:1.2.3'
    compile 'com.nhaarman.listviewanimations:library:2.6.0'
}

谁能帮我解决这个问题?

Can anyone help me to solve this problem?

推荐答案

This is bug https://code.google.com/p/android/issues/detail?id=75936(支持新的 dx 选项:--input-list=)已在更高版本的 Android 中修复工作室.我相信您运行的是旧版本;现代版本不允许您使用 Build Tools 19.1.0.尝试更新 Android Studio,按照其说明更新您的构建脚本以使用最新版本的 Android Gradle 插件,看看是否能解决您的问题.

This is bug https://code.google.com/p/android/issues/detail?id=75936 (Support new dx option: --input-list=) which has been fixed in later versions of Android Studio. I believe you're running an older version; a modern version wouldn't allow you to use Build Tools 19.1.0. Try updating Android Studio, following its instructions to update your build scripts to use the latest version of the Android Gradle plugin, and see if that solves your problem.

这篇关于“命令行太长"dexDebugTest 构建任务中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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