Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle hangs on Executing tasks: [:android:generateDebugSources

Since updating my Mac OS X to El Capitan (and android studio from 1.5.1 to 2.x with all tools and sdks) I have problems with my libgdx-robovm game in Android Studio. When I'm doing Gradle Sync it always hangs on:

Executing tasks: [:android:generateDebugSources, :android:generateDebugAndroidTestSources, :android:mockableAndroidJar, :android:prepareDebugUnitTestDependencies, :android-full:generateDebugSources, :android-full:generateDebugAndroidTestSources, :android-full:mockableAndroidJar, :android-full:prepareDebugUnitTestDependencies]

Always. By hanging I mean it goes forever.

I've seen few topics with the same problem, but I cannot find any solution and I'm really frustrated. I've tried:

1) Made sure that I have zlib installed (s /usr/include/zlib.h),

2) In Global Gradle settings I've tried turning on "Offline work", but result is the same,

3) Clearing robovm and gradle cache,

4) Restarting Android Studio,

5) Updating Android Studio to the latest stable version,

6) I've tried latest gradle, but it only raised new problems, finally after getting rid of them I got to the same point (hanging),

7) Removing .gradle directory,

8) Removing contents of build directory,

9) Clean & Rebuild,

10) Invalidate & Restart - after restarting it's not hanging, but any operation (clean, rebuild, sync) hangs gradle again,

11) Tried older Android Studio (1.5.1),

12) Tried different gradle plugin versions: 1.2.3, 1.5.0, 2.0+

13) Tried different android build tools (22.0.1 and 23.x.x)

14) Compiling straight from console (with -d for more logs):

Few last lines:

11:17:41.891 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Transitioning model element 'tasks.tasks' to state GraphClosed.

11:17:41.891 [INFO] [org.gradle.execution.TaskNameResolvingBuildConfigurationAction
]

Selected primary task 'tasks' from project : 11:17:41.893 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskGraphExecuter] Timing:

Creating the DAG took 0.002 secs 11:17:41.894 [INFO] [org.gradle.BuildLogger] All projects evaluated.

Configuring > 7/7 projects

(goes forever...)

edit:

The problem which probably caused this freeze was the fact that I had 2 subprojects for ios (robovm) and when I removed one of them it finally worked. This is only a problem for ios as for android 2 submodules wasn't an issue. I also had to update robovm to the latest version.

like image 350
Makalele Avatar asked Apr 19 '16 14:04

Makalele


2 Answers

We had this problem in our shop after the last upgrade, but all we had to do was

Build > Clean Project

Build > Rebuild Project

try to run it, if it doesnt work then go to

File > Invalid Caches / Restart and select "Invalidate and Restart"

then close the project, reopen it and run it again.

like image 76
programndial Avatar answered Sep 29 '22 09:09

programndial


delete .gradle file and after that 

Build > Clean Project

Build > Rebuild Project

try to run it, if it doesnt work then go to

File > Invalid Caches / Restart and select "Invalidate and Restart"

then close the project, reopen it and run it again.

like image 44
Yogesh Rathi Avatar answered Sep 29 '22 07:09

Yogesh Rathi