1

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-

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

Here is my 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?

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
Manoj
  • 3,947
  • 9
  • 46
  • 84

1 Answers1

1

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.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • @Manoj have you tried updating the build tools, grade plugin and android studio ? – Ahmad Ali Nasir Dec 04 '14 at 07:23
  • yes it shows me message that you are using latest beta version but it is not latest version plz have a look at this:http://stackoverflow.com/questions/27288367/how-to-update-android-studio-beta-channel – Manoj Dec 04 '14 at 07:47
  • now i am using Android studio 1.0 RC 4 but shows me the error as Gradle DSL method not found:'useOldManifestMerger()' i had removed it and run now it shows as Gradle DSL method not found:'apply()' how to fix this issue – Manoj Dec 08 '14 at 06:48
  • @Scott Barta now i am using Android studio 1.0 RC 4 but shows me the error as Gradle DSL method not found:'useOldManifestMerger()' i had removed it and run now it shows as Gradle DSL method not found:'apply()' how to fix this issue – Manoj Dec 08 '14 at 06:48
  • @Ahmad Ali Nasir Ali Nasir now i am using Android studio 1.0 RC 4 but shows me the error as Gradle DSL method not found:'useOldManifestMerger()' i had removed it and run now it shows as Gradle DSL method not found:'apply()' how to fix this issue – Manoj Dec 08 '14 at 06:50
  • @Manoj Please share your latest Gradle build script – Ahmad Ali Nasir Dec 08 '14 at 11:36
  • @Ahmad Ali Nasir !!! JUnit version 3.8 or later expected: java.lang.RuntimeException: Stub! at junit.runner.BaseTestRunner.(BaseTestRunner.java:5) at junit.textui.TestRunner.(TestRunner.java:54) at junit.textui.TestRunner.(TestRunner.java:48) at junit.textui.TestRunner.(TestRunner.java:41) at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:190) – Manoj Dec 08 '14 at 11:51
  • @Ahmad Ali Nasir i have several test case from baseActivity when i run my test case each individually i run's but if run from baseActivity by picking the option all it cases the error as JUnit version 3.8 or later expected: so updated with latest version but it remains the same is there any other go for solution – Manoj Dec 08 '14 at 11:54
  • @Manoj sorry for the late reply, but I have to look into it. If its possible for you to share your project, it may speed up things. Let me know if its possible, you can email me as well. – Ahmad Ali Nasir Dec 10 '14 at 13:00
  • @Ahmad Ali Nasir thanks a lot for your time bro i had fixed it. – Manoj Dec 10 '14 at 13:14