Skip to content

Instantly share code, notes, and snippets.

@maheshmnj
Last active March 12, 2024 03:49
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maheshmnj/6f5debbfae2b8183d94ca789d081f026 to your computer and use it in GitHub Desktop.
Save maheshmnj/6f5debbfae2b8183d94ca789d081f026 to your computer and use it in GitHub Desktop.
Native Android hacks

Table of Contents

  1. Install apk from Appbundle

  2. App not compatible for android 12 Issue

You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver
with intent filter, but without the 'android:exported' property set. This file can't be installed
on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported

1. Install apk from Appbundle

  1. Install bundletool using brew
brew install bundletool
  1. Run this command to extract and store the apks file at the desired location
bundletool build-apks --bundle=path/to/app-release.aab --output=/path/to/output/app.apks --local-testing
  1. Install apk on a connected android device
bundletool install-apks --apks=/path/to/output/app.apks
Complete logs
mahesh@Maheshs-MacBook-Air-M1 deferred_test % bundletool build-apks --bundle=/Users/mahesh/Downloads/deferred_test/build/app/outputs/bundle/release/app-release.aab --output=/Users/mahesh/Downloads/deferred_test/build/app/outputs/bundle/release/app.apks --local-testing
INFO: The APKs will be signed with the debug keystore found at '/Users/mahesh/.android/debug.keystore'.

mahesh@Maheshs-MacBook-Air-M1 deferred_test % bundletool install-apks --apks=/Users/mahesh/Downloads/deferred_test/build/app/outputs/bundle/release/app.apks
The APKs have been extracted in the directory: /var/folders/yt/1smr9dys1kj3p28q05l7nzy00000gp/T/7829213673295867160
The APKs have been extracted in the directory: /var/folders/yt/1smr9dys1kj3p28q05l7nzy00000gp/T/7829213673295867160
ADB << rm -rf '/sdcard/Android/data/com.example.deferred_test/files/local_testing'
ADB >> OK
ADB << mkdir -p '/sdcard/Android/data/com.example.deferred_test/files/local_testing' && rmdir '/sdcard/Android/data/com.example.deferred_test/files/local_testing' && mkdir -p '/sdcard/Android/data/com.example.deferred_test/files/local_testing'
ADB >> OK
Pushed "/sdcard/Android/data/com.example.deferred_test/files/local_testing/base-xxhdpi.apk"
Pushed "/sdcard/Android/data/com.example.deferred_test/files/local_testing/base-master_2.apk"
Pushed "/sdcard/Android/data/com.example.deferred_test/files/local_testing/base-de.apk"
Pushed "/sdcard/Android/data/com.example.deferred_test/files/local_testing/base-si.apk"
Pushed "/sdcard/Android/data/com.example.deferred_test/files/local_testing/base-vi.apk"
...
...
Pushed "/sdcard/Android/data/com.example.deferred_test/files/local_testing/base-arm64_v8a_2.apk"
Pushed "/sdcard/Android/data/com.example.deferred_test/files/local_testing/boxComponent-xxhdpi.apk"

ADB << run-as 'com.example.deferred_test' rm -rf '/data/data/com.example.deferred_test/files/splitcompat'
ADB >> run-as: package not debuggable: com.example.deferred_test
Failed to remove working directory with local testing splits. Your app might still have been installed correctly but have previous version of dynamic feature modules. If you see legacy versions of dynamic feature modules installed try to uninstall and install the app again.

2. App not compatible for Android 12 issue

see https://stackoverflow.com/a/72368059/8253662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment