Gradle builds really slow with a multi-project structure

后端 未结 3 1906
旧巷少年郎
旧巷少年郎 2020-12-24 07:12

When building with gradle on a multi-project setup containing roughly 140 projects/libraries, the build time took 1 hour and 22 minutes. And i was using --parallel

相关标签:
3条回答
  • 2020-12-24 07:40

    Did you try setting the parameters of the Gradles compiler?

    If you have remote dependencies, each time you run the project it will be operated with remote resources using the network. You should define the instruction to the Gradles compiler to that him to work offline using:

    --offline
    

    Here I leave you a screenshot of the compiler settings for better performance:

    enter image description here

    Or what is the same...

    enter image description here

    Source: http://gradle.org/docs/current/userguide/gradle_command_line.html

    0 讨论(0)
  • 2020-12-24 07:58

    Doing a clean you actually delete the already predexed libraries.
    As suggested in this thread you could save some time on clean builds by disabling predexing (because at the next build they will be deleted):

    android {
      dexOptions {
        preDexLibraries = false
      }
    }
    
    0 讨论(0)
  • 2020-12-24 08:04

    According to this post.

    Right now each project will pre-dex its dependencies on its own. This means 2 components depending on the same library will both run pre-dex on that library's classes.jar which is silly. We're looking at fixing this.

    0 讨论(0)
提交回复
热议问题