aapt finished with non-zero exit value 127 - android

For 2 days, I have been trying to get a blank android activity to compile on intellij idea ultimate on Ubuntu 14.04 64-bit. This error has really stumped me:
Error:Gradle: Execution failed for task ':app:mergeDebugResources'.
> /home/guarddog/Documents/github/IcsTrac/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res/drawable-ldrtl-hdpi/abc_ic_ab_back_mtrl_am_alpha.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/android-sdk-linux/build-tools/22.0.1/aapt'' finished with non-zero exit value 127
Note I have Java 8, Gradle 2.5 and /usr/local/android-sdk-linux/tools all in my $PATH.
I tried the advice here: Gradle build failed in Android Studio. But the error still occurs. How can I resolve this issue?

I meet the similar issue. I install lib32z1 and problem solved. Hope it could help.
Thanks #agustin.aliaga's answer in:
finished with non zero exit value
In my case, I had to install libz.so.1 library to make it work, on Ubuntu 15.04 with this command:
sudo apt-get install lib32z1
Later, I make a deep survey and found to support 32bit Android platform in ubuntu 64 os, one should install the 32bit library.
sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6

I usually just do Build> Rebuild Project or Clean Project
if that doesn't work then I go File> Invalidate/Caches Restart and choose Invalidate and Restart

Close Android Studio, delete build folders from your project location, than open AS and choose rebuild option.
Hope it help. Let me know if you still have that problem.
EDIT: Please, check also this issue:
finished with non zero exit value

Related

Is there a $PATH environment variable for Gradle commands within Android Studio?

I have a custom build script that runs an npm command. The command works on my command line, so its installed. But it doesnt run in Android Studio (Chipmunk 2021.2.1). Oddly, it used to run a couple weeks ago. Nothing has changed that I know of. The error is:
org.gradle.process.internal.ExecException: Process 'command 'npm'' finished with non-zero exit value 127
It looks like it cant find npm anymore because whatever AS is using as an environment PATH is out of sync with the system path (MacOS 12.4 zsh). How can I find and set the PATH Android Studio uses to find processes?
This question is similar but theres no answers for it.

Gradle Build Exception : AAPT process not ready to receive commands

This might be duplicate question but after trying all solution I'm not able to solve following error:
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: AAPT process not ready to receive commands
I tried all except one solution:
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
what exactly commands will be before executing this commands?? and if anyone have other solution than this please tell me, It will be very useful..
linux 64ver, install
lib32stdc++6(or lib32stdc++5)
lib32z1(maybe its name is lib32zlib)
you can search them here ,to confirm their real names in you linux distro repo. https://pkgs.org/
Go to Project structure by clicking (ctrl+shift+alt+s), in that go to Project tab change Gradle Version to 3.2 and Project Version to 2.2 .
This works fine for me.
The answer is simple .
inside the gradle module app change the build tool version to 23.0.3 , gradle version to 2.2.2

Gradle build is running for infinite time

I have latest Android Studio 2.1.2 with updated SDK and Operating System is Ubuntu 14.04 LTS. When I build my project than it starts building a gradle and it runs for infinite time. I have modified some basic settings like check an offline work and set org.gradle.daemon=true in gradle.properties file. I still can't figure out what is the main problem behind this.
when ever you find gradle is stuck at first run for unlimited time
you need these 2 commands
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
run it in terminal
an keep it safe some where
Update 1 :
if you have tried these commands then try to close existing project
remove .android .androidStudio settings .gradle from home and reopen your android studio make new project and wait it will for sure work
i have faced same situation

Android Studio cannot start aapt on Kali Linux

I installed Kali Linux on my PC yesterday and installed Android Studio. But when I build a project Android Studio gives me these errors:
Error:org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/root/Android/Sdk/build-tools/19.1.0/aapt''
Error:Execution failed for task ':app:mergeDebugResources'.
Error: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/root/Android/Sdk/build-tools/19.1.0/aapt''
I searched little on the internet. There is a solution for that:
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
When I run these commands in the terminal, it says:
Lîsteya pakêtan tê xwendin... Çêbû //reading package lists... Done
Building dependency tree
Reading state information... Çêbû
E: Pakêt nehate dîtin lib32stdc++6 //package is not found... Done
E: Couldn't find any package by regex 'lib32stdc++6'
What can I do?
The Problem is arising due to the misconfiguration of android adb and android development tools.
You Need to install some extra packages from the market place.
Android SDK Build-tools
(1)Location: $ANDROID_HOME/build-tools/$VERSION/
(2)Documentation
3.)Main tools: aapt (to generate R.java and unaligned, unsigned APKs), dx (to convert Java bytecode to Dalvik bytecode), and zipalign (to optimize your APKs).

Gradle build runs forever on a clean install and an empty project

Gradle builds run forever and I can't figure out why.
I have installed Android Studio on Ubuntu 15.04. It is set up with all of the default options from the wizard.
I have created an empty project and I have not added any code. When I attempt to build the project a gradle process starts up but never terminates. I have tried letting it run for an hour but there was no progress. I end up having to manually kill gradle in order to close Android Studio. (via "ps aux | grep gradle; kill -9 ")
I am using open-jdk 1.7, but I have also tried using oracle java (with the same results).
My desktop has 32 GB ram. I have attempted increasing the amount of memory allocated to Android Studio to no effect.
My CPU has AMD-64 architecture. Although I couldn't find anything on google suggesting this was the cause of my woes, could it be responsible?
There are no error messages that appear in the terminal when I run studio.sh manually. Below is the terminal output (annotated by me):
#starting Android Studio
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Starting process 'command '/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java''. Working directory: /home/cody/Documents/AndroidStudio/MyApplication Command: /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -version
Successfully started process 'command '/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java''
#gradle starts up, this never terminates unless I terminate it myself
Starting daemon process: workingDir = /home/cody/.gradle/daemon/2.4, daemonArgs: [/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant, -cp, /home/cody/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4/lib/gradle-launcher-2.4.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 2.4, /home/cody/.gradle, /home/cody/.gradle/daemon, 10800000, fb6e1111-7ac5-4afc-9630-890712f3195f, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant]Starting process 'Gradle build daemon'. Working directory: /home/cody/.gradle/daemon/2.4 Command: /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /home/cody/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4/lib/gradle-launcher-2.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 2.4 /home/cody/.gradle /home/cody/.gradle/daemon 10800000 fb6e1111-7ac5-4afc-9630-890712f3195f -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant
Successfully started process 'Gradle build daemon'
An attempt to start the daemon took 0.99 secs.
Connected to daemon DaemonInfo{pid=9307, address=[98dcf537-f8f6-4e74-ad4d-c57a86d4a6c1 port:48946, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=fb6e1111-7ac5-4afc-9630-890712f3195f,javaHome=/usr/lib/jvm/java-7-openjdk-amd64,daemonRegistryDir=/home/cody/.gradle/daemon,pid=9307,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=0ec396f9-4092-4fd1-93c4-0837d861cb85.1, currentDir=/home/cody/Documents/AndroidStudio/MyApplication}.
#I manually kill gradle
The message received from the daemon indicates that the daemon has disappeared.
Try sudo apt-get install lib32z1 as in this post. I had the same problem on Lubuntu and fixed it this way.
In my case, i already had lib32z1 installed. The problem was Genymotion plugin. Once i removed it from studio and restarted. It worked fine. I still don't know how that could happen as i regularly use genymotion with studio in my other machines. You can still run genymotion even if you remove studio plugin by starting emulator from genymotion itself.
I have centos 7 64 bits installed on a virtualbox 5.0.16 virtual machine and gradle version 2.10 with Android Studio 2.0
The log file of gradle is located at $HOME/.gradle/daemon/2.10
Log file: daemon-<some number>.out.log
By inspecting this log file I found out that libz.so.1 was not found by aapt.
Despite that command "locate libz.so.1" output was
/usr/lib64/libz.so
/usr/lib64/libz.so.1
/usr/lib64/libz.so.1.2.7
aapt was not able to find it.
In order to solve the issue I had to execute
yum install zlib.i686
After that Gradle started working.

Categories

Resources