The build of multi-channel packages should be familiar to android Developers. You can use ant to write a regular expression and then build n apk files,
Sometimes the situation will be more complicated. For example, if you have an app, you need to build some single-line libraries, and the code is basically the same as that of the main app. This is a matter of consideration for how to package it later.
If the problem of multi-channel buildname is actually 1xN, but now mXN is used, it will be very painful to use ant or gradle alone.
Now let's talk about the solution. The idea is to use the gradle flavor + shell script control channel.
Therefore, we only need to consider the single-line build by configuring build. add the desired flavor to gradle and set the Resource Directory. In this way, you can build different single-line libraries. Then, you can use sed to edit manifest, which is mainly to replace the value in mata-data, however, after all these operations are successfully integrated into a script file, you only need to modify the configuration file for future build.
Here I just talked about the solution. The specific script has been extracted from the project and put on github. I hope it can be used for reference by friends who encounter similar problems.
Https://github.com/avenwu/buildtool