#Patch fails to apply on Android

1 messages ยท Page 1 of 1 (latest)

gray tundra
#

I'm trying out Shorebird for my flutter app. In following the steps outlined I was trying to test a patch.
Here are the steps I tried

  1. I first did a shorebird release android
  2. This made the app available on Shorebird console
  3. Next I made some changes to code and created a patch using shorebird patch android
  4. This patch also showed up on the Shorebird console
  5. In order to test the app I ran shorebird release android --artifact=apk to get a apk so that I can run it locally
  6. Installed this generated apk by dragging it to emulator
  7. Restarted the app and saw the following logs in logcat "Caused by:
    Update rejected: hash mismatch. Update was downloaded but contents did not match the expected hash"

So my question will running shorebird release android and shorebird release android --artifact=apk will be treated as distinct builds?

small crane
#

The correct steps are:

  1. shorebird release android
  2. Made some changes
  3. shorebird patch android
  4. shorebird preview to install the release on an device
  5. Then you can restart the app to see the installed patch
gray tundra
#

Thanks @small crane for the feddback. Indeed the shorebird release android --artifact=apk will have the changes. I did release another patch to test and then I got the above error

small crane
#

The hash mismatch error indicates that the app you're running on the device is not the same as the one uploaded to Shorebird's servers.

#

Please refer to the steps and documentation I linked above and let me know if you run into any issues when following those steps.

#

You shouldn't re-run shorebird release android --artifact=apk because the apk that's generated will contain the changes that you made (and the apk will be different from the artifact you uploaded to Shorebird's servers the first time you ran shorebird release). You should only run shorebird release when you want to create a new release to upload to stores. You also generally want to always be bumping the release version and build number when you are creating new releases.

gray tundra
#

Thanks @small crane for the confirmation about the hash mistach ๐Ÿ‘

#

Really appreciate

small crane
#

Again the flow is:

  1. shorebird release android
  2. Distribute the artifact however you'd like
  3. Later you can make changes and run shorebird patch android
  4. Devices running the release generated in step 1 will get the patch (or you can test locally using shorebird preview)
gray tundra
#

I just did a test with releasing a ios via TestFlight and the patch was successfully applied

#

I have one more question ๐Ÿ™‚

small crane
#

That's great to hear! We also recently uploaded a tutorial on YouTube that walks through using Shorebird with Codemagic in case it's helpful. Even if you choose not to use Codemagic, hopefully the video will still help you better understand the overall flow of releasing and patching.
https://www.youtube.com/watch?v=stWph9Mthts

small crane
gray tundra
#

I want to restart the app automatically once the patch is downloaded using the shorebird_code_push package. Is it possible to do so without user intervention?

small crane
gray tundra
#

Ohh.. Perfect. Wanted to confirm that this is supported by Shoebird