I'm building an Android app on windows using gradle and when it comes to last module I'm facing the following error :
* What went wrong:
Execution failed for task ':client:test:dexApiPhoneDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\adt-bundle-windows\sdk\build-tools\19.1.0\dx.bat --dex --num-threads=
.....
Error Code:
1
Output:
The command line is too long.
I'm using the command line to build. I know that a similar issue can be solve if using Maven by mapping you project to a disk letter as described here : The command line is too long. in java project with maven
Do you have any idea how can I solve that issue using Gradle?
I figured out a workaround, it's not perfect but at least do the job.
Basically the project I had was under a long directory like : C:\Development\cloud\my.cloud\main\mycompany\android.
So as a workaround I mapped this folder to a network location, you can do that by using SUBST MS-DOS command or in Explorer under your computer use the GUI "Map a Network Drive". Actually I mapped it to a letter Z: and run my gradle command from there and it worked like a charm.
As I said it's not perfect but at least allowed me to move forward.
Making a network drive works but seems slower.
Instead of that, I found it better to create a link to the real directory. In Windows it goes like that:
mklink /j "D:\myshortname" "D:\my\long\directory\name\causing\trouble\but\its\not\my\fault\leave\me\alone"
Then I simply open the project from the symlinked directory instead of the real one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With