user2027722
user2027722

Reputation: 185

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.

Upvotes: 16

Views: 13600

Answers (3)

Rana Ranvijay Singh
Rana Ranvijay Singh

Reputation: 6155

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.

Upvotes: 1

Juan Pablo
Juan Pablo

Reputation: 1223

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.

Upvotes: 0

Nate
Nate

Reputation: 2519

Try sudo apt-get install lib32z1 as in this post. I had the same problem on Lubuntu and fixed it this way.

Upvotes: 34

Related Questions