Android Studio: Gradle hanging in infinite loop when building

I have a weird issue where Gradle isn’t advancing anymore with the build process. At least it seems that way, whenever I try to build my application it hangs at the same point. I let it run for 4.5 hours without any change.
The example applications work just fine, what I’m compiling right now is a Raspberry Pi / Linux x86 application.

It looks like make finishes successfully but Gradle stops at some scripts. Here is the Gradle output with --info and --debug enabled:

...compiling my last source file...
20:08:56.136 [LIFECYCLE] [org.gradle.api.Project] HOST_OS=MINGW32_NT-6.1
20:08:56.145 [LIFECYCLE] [org.gradle.api.Project] HOST_ARCH=i686
20:08:57.271 [LIFECYCLE] [org.gradle.api.Project] Done!
20:08:57.273 [LIFECYCLE] [org.gradle.api.Project] make: Leaving directory `/e/of_v20150918_android_release/libs/openFrameworksCompiled/project'
20:08:57.277 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':ofAndroidLib:compileReleaseOF'
20:08:57.278 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:compileReleaseOF (Thread[Task worker Thread 4,5,main]) completed. Took 17.758 secs.
20:08:57.279 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:compileReleaseNdk (Thread[Daemon worker,5,main]) started.
20:08:57.279 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:compileReleaseNdk
20:08:57.279 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':ofAndroidLib:compileReleaseNdk'
20:08:57.279 [INFO] [org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter] Skipping task ':ofAndroidLib:compileReleaseNdk' as it has no source files.
20:08:57.279 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':ofAndroidLib:compileReleaseNdk'
20:08:57.280 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:compileReleaseNdk UP-TO-DATE
20:08:57.280 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:compileReleaseNdk (Thread[Daemon worker,5,main]) completed. Took 0.001 secs.
20:08:57.280 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:packageReleaseJniLibs (Thread[Task worker Thread 7,5,main]) started.
20:08:57.280 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:packageReleaseJniLibs
20:08:57.280 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':ofAndroidLib:packageReleaseJniLibs'
20:08:57.280 [INFO] [org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter] Skipping task ':ofAndroidLib:packageReleaseJniLibs' as it has no source files.
20:08:57.281 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':ofAndroidLib:packageReleaseJniLibs'
20:08:57.281 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:packageReleaseJniLibs UP-TO-DATE
20:08:57.281 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:packageReleaseJniLibs (Thread[Task worker Thread 7,5,main]) completed. Took 0.001 secs.
20:08:57.281 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:packageReleaseLocalJar (Thread[Task worker,5,main]) started.
20:08:57.281 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:packageReleaseLocalJar
20:08:57.281 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':ofAndroidLib:packageReleaseLocalJar'
20:08:57.282 [INFO] [org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter] Skipping task ':ofAndroidLib:packageReleaseLocalJar' as it has no source files.
20:08:57.282 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':ofAndroidLib:packageReleaseLocalJar'
20:08:57.282 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:packageReleaseLocalJar UP-TO-DATE
20:08:57.282 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:packageReleaseLocalJar (Thread[Task worker,5,main]) completed. Took 0.001 secs.
20:08:57.282 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:packageReleaseRenderscript (Thread[Task worker Thread 7,5,main]) started.
20:08:57.282 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:packageReleaseRenderscript
20:08:57.282 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':ofAndroidLib:packageReleaseRenderscript'
20:08:57.283 [INFO] [org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter] Skipping task ':ofAndroidLib:packageReleaseRenderscript' as it has no source files.
20:08:57.283 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':ofAndroidLib:packageReleaseRenderscript'
20:08:57.284 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:packageReleaseRenderscript UP-TO-DATE
20:08:57.284 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:packageReleaseRenderscript (Thread[Task worker Thread 7,5,main]) completed. Took 0.002 secs.
20:08:57.284 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:bundleRelease (Thread[Task worker Thread 5,5,main]) started.
20:08:57.284 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:bundleRelease
20:08:57.284 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':ofAndroidLib:bundleRelease'
20:08:57.285 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ':ofAndroidLib:bundleRelease' is up-to-date
20:08:57.288 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Skipping task ':ofAndroidLib:bundleRelease' as it is up-to-date (took 0.003 secs).
20:08:57.288 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':ofAndroidLib:bundleRelease'
20:08:57.288 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :ofAndroidLib:bundleRelease UP-TO-DATE
20:08:57.288 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :ofAndroidLib:bundleRelease (Thread[Task worker Thread 5,5,main]) completed. Took 0.004 secs.

Hi!

I had same problem…
If you are under ubuntu you can fix that by installing 32 libs.

Fix android bug compilation on ubuntu

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
sudo apt-get install lib32stdc++6

I have the same problem on Windows. How would that fix work for me?