Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shorebird preview calls bundle-tool build-apks which might sign with the wrong keystore #2113

Open
Jonny1987 opened this issue May 15, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Jonny1987
Copy link

Jonny1987 commented May 15, 2024

App ID: 71b9cd57-235e-40ab-8d25-1861aa29aadf

Description

I am getting the following error after creating an android release and then running shorebird preview. Changed my keystore for the release version after setting up shorebird, but looking at the logs (The APKs will be signed with the debug keystore found at '/home/john/.android/debug.keystore'.), it is still trying to use the old keystore (debug.keystore).

I've tried reinstalling shorebird, cleaning cache, re-initialising shorebird and cleaning flutter cache.

Error:

Exception: Failed to install apks: The APKs have been extracted in the directory: /tmp/2698427712535263786
[BT:1.15.6] Error: Installation of the app failed.
com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Installation of the app failed.
    at com.android.tools.build.bundletool.model.exceptions.InternalExceptionBuilder.build(InternalExceptionBuilder.java:57)
    at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:196)
    at com.android.tools.build.bundletool.commands.InstallApksCommand.lambda$execute$2(InstallApksCommand.java:236)
    at com.android.tools.build.bundletool.device.AdbRunner.run(AdbRunner.java:81)
    at com.android.tools.build.bundletool.device.AdbRunner.run(AdbRunner.java:43)
    at com.android.tools.build.bundletool.commands.InstallApksCommand.execute(InstallApksCommand.java:236)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:117)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:55)
Caused by: com.android.ddmlib.InstallException: Failed to commit install session 2145140906 with command cmd package install-commit 2145140906. Error: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.getworkwith.workwith signatures do not match newer version; ignoring!

Steps To Reproduce

  1. Install and init shorebird
  2. change release keystore in build.gradle
  3. shorebird release android
  4. shorebird preview

Expected Behavior

Shorebird should use the new keystore

@Jonny1987 Jonny1987 added the bug Something isn't working label May 15, 2024
@Jonny1987
Copy link
Author

I realise this error is because shorebird preview simply uses the default debug keystore and I was expecting it to use the release keystore. Also, my app was not working even when uninstalling the previous version first because I had set the debug keystore in build.gradle to a different one and was again expecting that shorebird would use that. Reverting back to the default keystore with default alias and password makes everything work

@eseidel
Copy link
Contributor

eseidel commented May 16, 2024

shorebird preview just downloads and installs the saved off .aab from a previous shorebird release. It doesn't do any building or use any keystores (to my knowledge).

I would expect shorebird release to use flutter build --release which I would expect to use the release keystore in Gradle.

There might still be something for us to fix here? I'm not yet sure.

@Jonny1987
Copy link
Author

Jonny1987 commented May 16, 2024

So I checked the certificate of the aab file and it WAS the correct (release) one.

But the preview command was still using debug.keystore according to it's logs.

It looks like the preview command builds the apks using bundletool build-apks command. Since the keystore is not being specified it uses the default one (https://developer.android.com/tools/bundletool). Which means if someone has changed their default one (although not sure why they would...I realised I didn't need to and have changed mine back to the default) then it won't work. (Also, should it be using the release keystore one here? Maybe it doesn't matter...I'm new to mobile development)

I think this issue was just because I changed my default debug keystore in build.gradle for a reason which wasn't actually a good reason, and probably nobody ever needs to change it

@eseidel
Copy link
Contributor

eseidel commented May 16, 2024

Wow, you're right. I didn't realize that bundletool could end up changing the signing!

await bundletool.buildApks(bundle: aabFile.path, output: apksPath);

@eseidel eseidel changed the title Shorebird still using old keystore after it has changed in app/build.gradle shorebird preview calls bundle-tool build-apks which might sign with the wrong keystore May 16, 2024
@eseidel eseidel reopened this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants