Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 2.x - Building Symbols... Forever

I have problem with Android Studio. After updating AS to 2.2 it takes a long (~30 min) time to process indicating that it is "Building Symbols..." The project is reasonably large and includes NDK components.

Building using gradle is quite fast:

BUILD SUCCESSFUL
time: 12.089 secs

My gradle_wrapper settings:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
android.useDeprecatedNdk=true
org.gradle.daemon=true
org.gradle.parallel=true
#android.dexOptions.preDexLibraries=true
#android.enableBuildCache=true
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m-
HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

Whats wrong with Android Studio? How can I speed up it?

like image 890
TazmanOne Avatar asked Sep 22 '16 13:09

TazmanOne


1 Answers

Try changing the VM options?

It is possible your VM is running out memory or you're under memory pressure. You can try increasing the amount of memory available to Android Studio under Help you can choose Edit Custom VM Options.

-Xms256m
-Xmx8192m
-XX:ReservedCodeCacheSize=2048m
-XX:+UseCompressedOops
-XX:MaxPermSize=4096m

Delete all the .idea directories and re-import the project

Close Android Studio and in the project directory and delete all .idea folders. On macOS or Linux that might be accomplished with the find command.

find . -name .idea -type d -exec rm -rf {} +

Then launch Android Studio and re-import the project.

Switch to CMake

Android Studio's NDK support is based upon CLion which uses CMake as its project file format. I found that switching my large project to pure CMake put a permanent end to the Building Symbols problem. It makes sense, since it is probably more thoroughly tested by JetBrains and easier to support than Android.mk projects.

like image 109
Cameron Lowell Palmer Avatar answered Oct 03 '22 15:10

Cameron Lowell Palmer