Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating debug apk file using gradle on headless server error

I'm trying to create a debug apk file using gradle on Linux headless server using ./gradlew assembleDebug but I get following error

java.io.IOException: Cannot run program "/usr/android/android-sdk-linux/build-tools/23.0.1/aapt": java.io.IOException: error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:494)
        at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:138)
        at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:96)
        at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:188)
        at java.lang.Thread.run(Thread.java:701)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
        at java.lang.ProcessImpl.start(ProcessImpl.java:81)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:476)
        ... 4 more
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Crunching Cruncher abc_btn_radio_to_on_mtrl_000.png failed, see logs 
like image 331
Mohamad Shaker Avatar asked Sep 21 '15 15:09

Mohamad Shaker


1 Answers

I had the same problem when compiling an app using gradlew on a Linux server. In short, the application exists, but you get an error when you try to execute it.

The following solution worked for me: https://superuser.com/questions/892945/no-such-file-or-directory-when-executing-an-existing-file

In my case, the application does not run because it is missing some 32 bit dependencies. According to the google documentation at: http://developer.android.com/sdk/installing/index.html?pkg=tools (Under [Show instructions for all platforms] -> Troubleshooting Ubuntu) you should install libncurses5:i386, libstdc++6:i386, and zlib1g:i386 for Ubuntu 13.10 and above.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

Or install ia32-libs for earlier versions of Ubuntu

apt-get install ia32-libs
like image 153
Jeroen Plug Avatar answered Sep 28 '22 09:09

Jeroen Plug