search

Home  >  Q&A  >  body text

android-studio - Android studio编译速度太慢,每次都要一分钟

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

迷茫迷茫2771 days ago1223

reply all(13)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:41:39

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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:41:39

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

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 17:41:39

    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.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 17:41:39

    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.

    reply
    0
  • 阿神

    阿神2017-04-17 17:41:39

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

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 17:41:39

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

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 17:41:39

    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.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:41:39

    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,

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 17:41:39

    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.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:41:39

    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

    reply
    0
  • Cancelreply