Android Studio 2.x-永久构建符号... [英] Android Studio 2.x - Building Symbols... Forever
问题描述
我在使用Android Studio时遇到问题.将AS更新为2.2之后,需要花费很长的时间(〜30分钟)来表明它是正在构建符号...".该项目相当大,并且包含NDK组件.
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.
使用gradle进行构建非常快:
Building using gradle is quite fast:
BUILD SUCCESSFUL
time: 12.089 secs
我的gradle_wrapper设置:
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
Android Studio有什么问题?我该如何加快速度?
Whats wrong with Android Studio? How can I speed up it?
推荐答案
尝试更改VM选项吗?
您的VM可能耗尽内存或内存不足.您可以尝试在Help
下选择可以增加Edit Custom VM Options
的Android Studio可用内存量.
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
删除所有.idea目录,然后重新导入项目
关闭Android Studio并在项目目录中,然后删除所有.idea文件夹.在macOS或Linux上,可以使用find
命令来完成.
find . -name .idea -type d -exec rm -rf {} +
然后启动Android Studio并重新导入项目.
Then launch Android Studio and re-import the project.
Android Studio的NDK支持基于CLion,后者使用CMake作为其项目文件格式.我发现将我的大型项目切换为纯CMake可以永久解决建筑符号问题.这是有道理的,因为它可能已经由JetBrains进行了更彻底的测试,并且比Android.mk项目更易于支持.
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.
这篇关于Android Studio 2.x-永久构建符号...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!