beeware / briefcase-android-gradle-template

A template for generating Android Gradle projects with Briefcase
MIT License
18 stars 19 forks source link

Apps installed from Google Play using AAB format crash on start #42

Closed t-arn closed 2 years ago

t-arn commented 2 years ago

Describe the bug Since August 2021, new apps that are uploaded to Google Play must use the AAB format. But apps that are uploaded as AAB and then installed from Google Play crash on app startup with the following error:

2021-12-28 08:28:31.847 23118-23118/? E/MainActivity: Failed to create Python app
    java.lang.Exception: Unable to compute Python version
        at org.beeware.android.MainActivity.startPython(MainActivity.java:216)
        at org.beeware.android.MainActivity.onCreate(MainActivity.java:248)
        at android.app.Activity.performCreate(Activity.java:7993)
        at android.app.Activity.performCreate(Activity.java:7982)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3246)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7397)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

To Reproduce Steps to reproduce the behavior:

  1. Create an AAB for the "command" example of Toga, using the Toga code from the master branch [1198c0f] and the briefcase-android-gradle-template code from the dev branch [f251575]
  2. Sign the AAB
  3. Uplad the AAB to Google Play
  4. Install the app from Google Play
  5. Run the app

The behaviour can also be tested locally:

  1. Create an AAB for the "command" example of Toga, using the Toga code from the master branch [1198c0f] and the briefcase-android-gradle-template code from the dev branch [f251575]
  2. Connect your Android phone
  3. Run bundletool build-apks with the --connected-device option
  4. Run bundletool install-apks
  5. Run the app

Expected behavior An app installed from Google Play must start correctly. This must be true for apps uploaded as APK or AAB.

Environment:

t-arn commented 2 years ago

This seems to be the reason: https://stackoverflow.com/questions/56551036/native-libraries-not-found-in-applicationinfo-nativelibrarydir-when-building-app

t-arn commented 2 years ago

@freakboy3742 Please review this PR. Sorry for piling up another one...