也许是一个已知的问题,但寻找加速Android构建的方法。我的大约是20-25秒,并不可怕,但在尝试测试增量更改时有点麻烦。
显然,获得一个更快的CPU会有帮助,但如果有任何软件级别的调整/提示,就可以找到Android。
谢谢。
发布于 2015-07-10 21:46:14
我能够将构建时间缩短到3-5秒。
在我看来,RAM设置是绝对必须的--在给它2GB之后(我有24 2GB的空间可以节省),UI是快速和快速的&代码编辑非常快,一点也不滞后。
以下是我使用的全部说明:
Android设置:https://extremegtx.wordpress.com/2015/01/08/android-studio-speed-up-studio-and-gradle/
说明是针对Windows的,如果您在MAC上,请使用以下路径:~/Library/Preferences/{FOLDER_NAME}/studio.vmoptions
分级设置:http://jimulabs.com/2014/10/speeding-gradle-builds/
作为参考,我正在运行一个超频Xeon X5650 @ 3.85GHz,并编译一个包含大量库和依赖项的相当大的项目。
发布于 2016-01-08 20:44:28
使用android工作室是一个相当痛苦的经历,我注意到的事情很少,我希望它们能有所帮助。
- Do the development on a PC(am using Win10), build a signed APK copy it to my device and test the compiled version. Whenever i make changes i have to repeat the build process! Its faster for me than debugging direct through the emulator.
- Disabling most services on the PC works pretty well with me. Open - RUN -type 'msconfig' - load basic devices and services. Then restart the PC. start android studio and see if anything changes.
- In both situations i try as much as possible to avoid the emulator
- For database testing you can use a separate machine with test data or open 'services.msc' and enable your database and web server + Network access.
发布于 2018-08-19 08:31:54
我们可以将几个命令添加到gradle.properties文件中:
org.gradle.configureondemand=true -这个命令将告诉gradle只构建真正需要构建的项目。
使用守护进程org.gradle.daemon=true
org.gradle.parallel=true -
允许gradle并行构建您的项目。如果项目中有多个模块,那么通过启用该功能,gradle可以并行地运行独立模块的构建操作。
增加堆大小 - org.gradle.jvmargs=-Xmx3072m -
-XX:+HeapDumpOnOutOfMemoryError -Dfile.code=UTF-8-从AndroidStudio2.0开始,gradle在过程中使用dex来减少项目的构建时间。通常,在构建应用程序时,多个dx进程运行在不同的VM实例上。但是从AndroidStudio2.0开始,所有这些dx进程都运行在单个VM中,并且VM也与gradle共享。这大大减少了构建时间,因为所有的dex进程都运行在相同的VM实例上。但是这需要更大的内存来容纳所有的dex进程和gradle。这意味着您需要增加gradle守护进程所需的堆大小。默认情况下,守护进程的堆大小约为1GB。
确保不使用动态依赖关系。即不使用
实现‘com.android.Support:appcompat-v7:27.0.这个命令意味着gradle每次构建应用程序时都会上网查看最新版本。相反,使用固定版本,即“com.android.Support:appcompat-v7:27.0.2”
https://stackoverflow.com/questions/28494906
复制相似问题