Gradle 构建在全新安装和空项目上永远运行 [英] Gradle build runs forever on a clean install and an empty project

查看:26
本文介绍了Gradle 构建在全新安装和空项目上永远运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gradle 构建永远运行,我不知道为什么.

Gradle builds run forever and I can't figure out why.

我已经在 Ubuntu 15.04 上安装了 Android Studio.它使用向导中的所有默认选项进行设置.

I have installed Android Studio on Ubuntu 15.04. It is set up with all of the default options from the wizard.

我创建了一个空项目并且我没有添加任何代码.当我尝试构建项目时,gradle 进程会启动但从未终止.我试过让它运行一个小时,但没有任何进展.我最终不得不手动杀死 gradle 才能关闭 Android Studio.(通过ps aux | grep gradle;kill -9")

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 ")

我使用的是 open-jdk 1.7,但我也尝试过使用 oracle java(结果相同).

I am using open-jdk 1.7, but I have also tried using oracle java (with the same results).

我的桌面有 32 GB 内存.我曾尝试增加分配给 Android Studio 的内存量但无效.

My desktop has 32 GB ram. I have attempted increasing the amount of memory allocated to Android Studio to no effect.

我的 CPU 具有 AMD-64 架构.虽然我在谷歌上找不到任何暗示这是我的问题的原因,但它可以负责吗?

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?

当我手动运行 studio.sh 时,终端中没有出现错误消息.以下是终端输出(由我注释):

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.

推荐答案

这个 帖子.我在 Lubuntu 上遇到了同样的问题并通过这种方式修复了它.

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

这篇关于Gradle 构建在全新安装和空项目上永远运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆