Speeding up the Android build process

前端 未结 3 704
灰色年华
灰色年华 2020-12-06 23:05

This is a real noob question. I work for a company that makes 100\'s of apps that use much of the same components. There is some minor customization at build time and we w

相关标签:
3条回答
  • 2020-12-06 23:28

    Adopting some command-line build tools like Maven or Ant is definitely the right direction to go, it enables the possibilities of batching build process using Unix/Windows shell scripts.

    Those minor customization you required are quite easy to achieve using maven-properties-plugin and android-maven-plugin together. android-maven-plugin support resource filtering. you can define your customized properties for each build cycle into several properties files, during the build process, android-maven-plugin can read those value from external properties file and substitute those value in AndroidManifest.xml and other resource file like res/values/strings.xml. android-maven-plugin also fully support Android Library Project, which let you extract/centralize common android code and manage all of them easily.

    Suppose you want to build 5 apk distributions from a same Android Project with different package/app name, app icon and some resources in string.xml, you can create shell script run mvn deploy 5 time,with each time copy one of your customize.properties with proper other icon.png files into the project directory and overwrite the existing one. this gives you an end-to-end auto build batch processing that doesn't need any human interaction.

    You can find a sample project MorseFlash examine the resource filtering used by android-maven-plugin.

    0 讨论(0)
  • 2020-12-06 23:30

    try using make on multicore machine and split the build process between cores by giving

    make -j<x> command
    
    0 讨论(0)
  • 2020-12-06 23:44

    I would definitely suggest to use at the Android Maven Plugin. If your apps are only slight customizations you should be able to move most of the work into an external library that you build once and then only the customizations kick in at build time for each app. With the scale you are talking about that would easily be worth the effort.

    Check out the plugin site and the chapter in I wrote about using Maven for Android development for a starter and to get a feel.

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