Gradle hangs on Executing tasks: [:android:generateDebugSources
<p>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:</p>

<blockquote>
  <p>Executing tasks: [:android:generateDebugSources,
  :android:generateDebugAndroidTestSources, :android:mockableAndroidJar,
  :android:prepareDebugUnitTestDependencies,
  :android-full:generateDebugSources,
  :android-full:generateDebugAndroidTestSources,
  :android-full:mockableAndroidJar,
  :android-full:prepareDebugUnitTestDependencies]</p>
</blockquote>

<p>Always. By hanging I mean it goes forever.</p>

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

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

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

<p>3) Clearing robovm and gradle cache,</p>

<p>4) Restarting Android Studio,</p>

<p>5) Updating Android Studio to the latest stable version,</p>

<p>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),</p>

<p>7) Removing .gradle directory,</p>

<p>8) Removing contents of build directory,</p>

<p>9) Clean &amp; Rebuild,</p>

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

<p>11) Tried older Android Studio (1.5.1),</p>

<p>12) Tried different gradle plugin versions: 1.2.3, 1.5.0, 2.0+</p>

<p>13) Tried different android build tools (22.0.1 and 23.x.x)</p>

<p>14) Compiling straight from console (with -d for more logs):</p>

<p>Few last lines:</p>

<blockquote>
  <p>11:17:41.891 [DEBUG]
  [org.gradle.model.internal.registry.DefaultModelRegistry]
  Transitioning model element 'tasks.tasks' to state GraphClosed.</p>
  
  <p>11:17:41.891 [INFO]
  [org.gradle.execution.TaskNameResolvingBuildConfigurationAction<br>
  ]      </p>
  
  <p>Selected primary task 'tasks' from project : 11:17:41.893 [DEBUG]
  [org.gradle.execution.taskgraph.DefaultTaskGraphExecuter] Timing:</p>
  
  <p>Creating the DAG took 0.002 secs 11:17:41.894 [INFO]
  [org.gradle.BuildLogger] All projects evaluated.</p>
  
  <p>Configuring > 7/7 projects</p>
</blockquote>

<p>(goes forever...)</p>

<p>edit:</p>

<p>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.</p>