Gradle stuck at building project in Android Studio

I am using Android Studio, and every time Gradle attempts to build my project, it gets stuck. What I mean by that is it gives me the build dialog for hours at a time, and I am unable to build my project. Here is a screenshot:Android Studio Gradle Build

I have scoured what seems like the entire whole of the internet, but no solution I have found seems to work. I am new to Android development, so there is probably something here that's staring me straight in the face. The main thing that sticks out to me is this portion of the logs in my .gradle directory:

DaemonExpirationPeriodicCheck running
16:20:23.790 [DEBUG] [org.gradle.launcher.daemon.server.health.DaemonStatus] GC rate: 0.0/s
16:20:23.793 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
16:20:23.795 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
16:20:23.803 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
16:21:23.790 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
16:21:23.791 [DEBUG] [org.gradle.launcher.daemon.server.health.DaemonStatus] GC rate: 0.0/s
16:21:23.794 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
16:21:23.795 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
16:21:23.800 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
16:22:23.792 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
16:22:23.793 [DEBUG] [org.gradle.launcher.daemon.server.health.DaemonStatus] GC rate: 0.0/s
16:22:23.798 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
16:22:23.799 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
16:22:23.806 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
16:23:23.794 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
16:23:23.795 [DEBUG] [org.gradle.launcher.daemon.server.health.DaemonStatus] GC rate: 0.0/s
16:23:23.800 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
16:23:23.800 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
16:23:23.807 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.

I just wanted to let everyone know that I figured it out! Apparently my parents put some insanely powerful parental control software on my computer a few years ago and I forgot it was there. So if any of you have Qustodio Parental Control on your computer, beware that it will prevent you from doing anything related to software development. After uninstalling, Android Studio now works flawlessly. The software basically blocked all unknown traffic coming in and out of most of the ports. Anyway, thank you to everyone for the help. I can finally start developing!


I once had this same issue and after some struggle i found a temporary solution to this problem, later on I updated my AS and JDK to latest version and the problem was resolved.

Temporary solution: After you see the same sequence starts to show in log, just simply start TaskManager and kill java process. It will stop this never ending loop of gradle build and your app will be installed on device(emulator or physical) without any issues.

Later on you can update AS and JDK to latest versions and be sure to provide valid path to JDK.


if you are on windows ,

Try deleting your .gradle from C:Users<username> directory and try again.

or

go to Android Studio -> Preferences -> Gradle -> and tick Offline work .

sometimes it also work following way

File Menu - > Invalidate Caches/ Restart->Invalidate and Restart .

链接地址: http://www.djcxy.com/p/93200.html

上一篇: 触发Maven远程释放

下一篇: Gradle坚持在Android Studio中构建项目