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

13,205

Solution 1

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

Solution 2

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.

Share:
13,205

Related videos on Youtube

user2027722
Author by

user2027722

Updated on July 02, 2022

Comments

  • user2027722
    user2027722 almost 2 years

    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.
    
    • user2027722
      user2027722 over 8 years
      What do you mean by a proxy?
  • user2027722
    user2027722 over 8 years
    This, plus I had to restart my machine. That was the part that took me a long time to figure out. I would install some libs, realize they didn't change anything, and then uninstall them again!
  • Nactus
    Nactus over 8 years
    you're 'da man! +1 on this lib install (fixed my Android Studio 1.4 on Ubuntu 15.04)
  • ghoulfolk
    ghoulfolk about 8 years
    Any ideas on how this problem can be fixed on windows OS?
  • Nate
    Nate about 8 years
    @ghoulfolk, I only saw this problem on Linux. My Windows installation went smoothly. Not sure what to suggest for Windows.
  • ArunL
    ArunL about 8 years
    Yeah, this fixed the forever gradle building in Android Studio 2.0 beta 7 with gradle plugin 2.0.0-beta7 in Ubuntu 15.10. Thanks!