APK errors

Installing an AAB file on a phone

Error text

Error: cannot install .aab directly. / bundletool: Unable to find a device matching the spec / The APKs archive is signed with the debug key

Cause

An AAB is meant for Play and cannot be installed on a phone directly. You must turn it into an APK set with bundletool.

Step-by-step fix

  1. Download bundletool and make sure Java is installed.
  2. Create a .apks with build-apks; give your own keystore for signing.
  3. Install on the connected device with install-apks --apks=app.apks.
  4. If you need a single APK that works anywhere, use --mode=universal.
  5. If no device is found, check adb devices.

Example commands

bundletool build-apks --bundle=app.aab --output=app.apks --ks=release.jks --ks-key-alias=release
bundletool install-apks --apks=app.apks
bundletool build-apks --bundle=app.aab --output=app.apks --mode=universal
unzip app.apks -d out

How to prevent it

Keep the AAB for distribution and a universal APK for internal testing.

Author and license: Nibras Code