Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building many similar Android .apk files at the same time?

I've got a single Android project which I need to build many .apk's from. The .apk's differ from each other in only a few ways:

  1. there are a few values in the Android manifest file that differ from each other
  2. some of the .apk's might exclude some files in the /res folder
  3. different package name

What is the best way to build all these different .apk's automatically?

Thanks!

like image 495
Robert Bana Avatar asked Nov 10 '11 09:11

Robert Bana


People also ask

How you will create generate multiple APK in a package?

To generate multiple apks for specific types of abiWrite these block of code in your app level gradle file and click build apk. This block of code will generate apk for x86 and mips. For abi, universalApk is false by default, you need to set it to true to generate Universal Apk.

What is multi APK?

Multiple APKs is a feature on Google Play that allows developers to upload multiple APKs based on pixel density, locale, ABI, API levels, etc. Android Developers documentation lists many rules that developers need to address before publishing APKs on Google Play.

Do developers need to build two different Android app?

You definitely don't want to create a separate . apk for each individual platform. The Android docs strongly encourage you bundle everything in one .

What is the difference between APK and bundle?

App bundles are publishing format, whereas APK (Android application Package) is the packaging format which eventually will be installed on device. Google uses app bundle to generate and serve optimized APKs for each user's device configuration, so they download only the code and resources they need to run your app.


1 Answers

Use Android Maven plugin. It supports android library projects.

  1. Create a multi-module project.
  2. Put all common classes in one module (library).
  3. Create a module for each app you want to distribute and make it depend on lib module.

Here is an example: https://github.com/jayway/maven-android-plugin-samples/tree/master/libraryprojects

(You will need to create several 'libraryprojects-mainapp' modules)

like image 140
Peter Knego Avatar answered Nov 15 '22 08:11

Peter Knego