android-studio - Android studio编译速度太慢,每次都要一分钟
迷茫
迷茫 2017-04-17 17:39:39
0
13
1220

有没有比较好的解决方法,除了换电脑

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(13)
洪涛

Alibaba’s FreeLine https://github.com/alibaba/fr...
Compilation takes 3~5 seconds

Ty80

Use third-party solutions such as BUCK and LayoutCast. Ali’s FreeLine is also good. Here is a blog https://yq.aliyun.com/article...

巴扎黑

Actually, I think 1 minute is not too slow.
Or you can upgrade Android studio to 2.0 or above, which has a new feature of fast compilation.

左手右手慢动作

Put

in gradle.properties
# Default value: -Xmx10248m -XX:MaxPermSize=256m
#org.gradle.daemon=false
#org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

It should be better if you loosen some configurations here.

阿神

Gradle就是这么慢的,没办法,Android Studio 2.0以上有Instant installIt can speed up compilation, but there is a problem with this function

Peter_Zhu

One minute goes by quickly. Mine can take a nap.

左手右手慢动作

Depending on the amount of code you have, one minute can be long or short, and gradle is indeed not fast. In addition to adding org.gradle.parallel=true to gradle.properties, you can also choose to add

org.gradle.configureondemand=true
org.gradle.daemon=true

Using the latter requires some machine memory. It depends on the situation. The former may cause the compilation results to be inconsistent with expectations. If your project does not have a very special structure, it does not matter.

大家讲道理

linux system + solid state (this is more important). This can improve a lot of efficiency. Removing some unused images and files can also improve speed. The application of ubuntu 14 i3-4170 8G 23M is 40 seconds,

Peter_Zhu

Write the functions that need to be tested separately into UnitTest to reduce the number of times you need to start the entire APP test, which should improve your happiness.

In addition, as mentioned above, it would be good to switch to a solid state, and a cpu i3 can also be used.

伊谢尔伦

1. Increase the memory occupied by AS


-Xms256m
-Xmx4096m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops

2. Turn on offline mode and search offline in settings

For specific operations, just google it yourself, there are many tutorials

But the project is big, more than 1 minute is normal

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template