n.arrow001
n.arrow001

Reputation: 1140

merging multiple apks from bundle into one

Is it possible to merge multiple apks generated through android app bundle into one single installable/distributable apk?

I have tried installing through adb install-multiple but in this manner, its not distributable.

Upvotes: 5

Views: 4342

Answers (3)

chjaeggi
chjaeggi

Reputation: 13

Not sure if this is still a problem for you? With regard to the official android docs:

https://developer.android.com/studio/command-line/bundletool#device_specific_apks

you should be able to

Extract device-specific APKs from an existing APK set

with the help of bundletool

bundletool extract-apks
--apks=/MyApp/my_existing_APK_set.apks
--output-dir=/MyApp/my_pixel2_APK_set.apks
--device-spec=/MyApp/bundletool/pixel2.json

with

  • --apks => your apk set
  • --output-dir => desired output
  • --device-spec => a json file of your device specifics

If this won't solve your problem and you obtained the bundle through play store in the first place, this could also help you:

Share an install link To share a link to install the appropriate device-specific APK that Google Play generates from your app bundle: Open the App bundle explorer page (Release > App bundle explorer). Select the version filter near the top right of the page. On the “Choose a version” table, select the right arrow on the version that you want to view. Select the Downloads tab. To share a link to install a device-specific APK: In the “Internal app sharing link” section, select Copy shareable link. Share the link. Tip: You can select Manage access to visit the Internal app sharing page and quickly share app bundle and APK links with your team. To learn more, go to Share app bundles and APKs internally.

as described here: https://support.google.com/googleplay/android-developer/answer/9844279?hl=en

Upvotes: 1

Pierre
Pierre

Reputation: 17417

Bundletool build-apks command has a --mode=universal flag which allows you to build a universal APK which contains everything.

It operates on the App Bundle though, not the generated APKs.

Upvotes: 1

Mithun Sarker
Mithun Sarker

Reputation: 4023

Probably you used abi split . Just put universalApk true inside your split like following, you will get a single apk for all .

android {
    splits {
        // Configures multiple APKs based on ABI.
        abi {
            // Enables building multiple APKs per ABI.
            enable true

            // By default all ABIs are included, so use reset() and include to specify that we only
            // want APKs for x86, armeabi-v7a, and mips.
            reset()

            // Specifies a list of ABIs that Gradle should create APKs for.
            include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"

            // Specifies that we want to also generate a universal APK that includes all ABIs.
            universalApk true
        }
    }
    //...    
}

Upvotes: 0

Related Questions