Gradle hangs on Executing tasks: [:android:generateDebugSources
Asked Answered
V

4

7

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.

Violence answered 19/4, 2016 at 14:5 Comment(10)
What happens if you build from the command line? Any useful error messages?Organometallic
I've closed android studio, gave gradlew +x permission, ran clean task and it hanged on: > Configuring > 7/7 projectsViolence
When running with -d (debug) switch last log before Configuring > 7/7 Projects is 08:47:30.002 [INFO] [org.gradle.BuildLogger] All projects evaluated.Violence
can you please try to create new project from scratch, copy paste the previous code to new one and then try to replicate the issue.Libnah
try to use gradle 1.5.1 not 2.0 in project gradleRaynor
I'm using it already. Like I said on 2.0 I had even more problems..Violence
What the --debug command line option says?Pennate
See my comment few posts before: When running with -d (debug) switch last log before Configuring > 7/7 Projects is 08:47:30.002 [INFO] [org.gradle.BuildLogger] All projects evaluated.Violence
did u try increasing the memory allocation?Isabelleisac
Yeah, still no luck. I even tried reverting to older android studio.Violence
C
2

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.

Crying answered 27/4, 2016 at 19:12 Comment(0)
T
2
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.

Tewfik answered 28/4, 2016 at 6:21 Comment(0)
F
0

Try some of these too :

  1. Delete manually all the build's outputs created.
  2. In setting -> Build tools -> check for default gradle wrapper.
  3. Remove extra gradles versions , keep the latest one in studio.
  4. Invalidate and restart.

Hopefully this will solve your problem. :)

Flume answered 28/4, 2016 at 13:39 Comment(1)
Thanks for answer, but it didn't help. Still the same problem.Violence
T
0

I overcome that issue by following way:

File:Settings >> Instant Run >> Disable instant run

and then

Invalidate cache and Restart

Turnkey answered 24/9, 2016 at 12:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.