Reputation: 113
I'm having problem creating a standalone apk from a bundle file in android using bundletool.
I wrote an application that contains multiple modules (downloadable separately using splitInstallManager) and deploy it as a bundle (app.aab) file. So far so good, however for whatever reason, I also need to generate a standalone apk for one specific device and I cant seem to get it done.
What I have:
1. my app.aab
2. my keystore
3. specs file for the device generated using "bundletool get-device-spec"
What I am doing:
java -jar bundletool.jar build-apks --ks=[my keystore] --ks-pass=[password] --ks-key-alias=[alias] --key-pass=[key password] --bundle=app.aab --output=app.apks --device-spec=device-specs.json --overwrite
According to
bundletool help build-apks
when you pass device specs parameter to the tool it by default use "--mode=default" which means that the generated apks file should contain: "... If not set or set to 'default' we generate split, standalone and instant APKs. ...".
Problem is that generated app.apks file contains only "splits" subfolder.
In addition I get the following warning: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/home/oberon/Downloads/bundletool.jar) to field java.nio.Buffer.address WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
How do I generate a standalone apk ?!
Upvotes: 6
Views: 7796
Reputation: 17397
The standalone APKs are only generated if minSdkVersion < 21
.
If you want a universal APK, you can use --mode=universal
which will build a single APK that contains everything. As documented below https://developer.android.com/studio/command-line/bundletool
Upvotes: 7