#Binary mismatch error with Shorebird AAR (add-to-app) on Android

1 messages · Page 1 of 1 (latest)

echo obsidian
#

Hi Shorebird team,

I'm experiencing a persistent binary mismatch error when using Shorebird with Flutter add-to-app (AAR) embedded in a native Android project.

Setup:

  • Flutter module built as AAR using: shorebird release android --platforms aar
  • Native Android app consumes the AAR
  • Flutter version: 3.29.3 (fb8d194ceb)
  • Shorebird CLI: latest

Error from device logcat:
"This app reports version 4.2.16.12+23041812, but the binary is different
from the version submitted to Shorebird. hash mismatch."

What I found:

  • The AAR module file declares dependency: io.flutter/arm64_v8a_release:1.0.0-c4daf6fc...
  • The built APK contains libflutter.so (standard Flutter engine)
  • libshorebird_engine.so is NOT present in the APK
  • Even with maven { url 'https://download.shorebird.dev/download.flutter.io' }
    placed BEFORE Flutter storage in build.gradle, Gradle still resolves libflutter.so
    from Flutter storage (cached)

Question:
For add-to-app AAR integration, how do we ensure the native Android APK
uses the Shorebird engine instead of the standard Flutter engine?
Is there specific Gradle configuration required beyond adding the Shorebird maven URL?

Thank you!

marsh stirrupBOT
#

Hello! Thanks for reaching out. To help us look into this as quickly as possible, could you share a few details?
• App ID – found in your shorebird.yaml file
• Account email – the email associated with your Shorebird account
• Shorebird CLI version – run shorebird --version to grab this
• Platform – iOS, Android, Desktop?
• What you’re seeing – any error output or logs are super helpful

Once we have that, we’ll dig in!

echo obsidian
#

App ID: 89076dd2-4e3d-4788-bcde-4039a28cce17
Account email: [email protected]
Shorebird CLI version: 1.6.105
Platform: Android

Error logs:
"This app reports version 4.2.16.12+23041812, but the binary is different
from the version submitted to Shorebird. hash mismatch.
expected: 7b4aad072c9ae141d805918a988103df692ffe3bda2ef155960ee62ea15336d3
got: 988c7736429c635f3272e418cb96da915c5fbd9c7ee96a30b933f9e8085ced8c"

Additional findings:

  • APK contains libflutter.so (NOT libshorebird_engine.so)
  • curl to download.shorebird.dev for arm64_v8a_release artifact returns 404
  • Used command: shorebird release aar --release-version 4.2.16.12+23041812
  • settings.gradle uses FAIL_ON_PROJECT_REPOS with Shorebird maven URL
  • Flutter version used by project: 3.29.3 (fb8d194ceb)
  • Shorebird bundled Flutter: 3.44.0
marsh stirrupBOT
#

Hi there👋

A couple things to note.
• It would be best to upgrade Flutter in your project if possible. 3.29 is very old at this point so any fixes we are making are not being applied there.
• I attempted to view your application in our system and I'm not seeing that App ID. Did you remove it or copy in the wrong string?

echo obsidian
#

Hi Tom! Thanks for the response.

Good news — we managed to resolve the binary mismatch issue! Here's what we found and fixed:

Root cause: Gradle was stripping libapp.so during APK packaging, which changed the binary hash. This caused a mismatch between the hash submitted to Shorebird during shorebird release aar and the hash of libapp.so inside the installed APK.

Fix: We added packaging.jniLibs.keepDebugSymbols.add("**/libapp.so") in the release buildType of our native Android app's build.gradle. This prevents Gradle from stripping libapp.so, ensuring the hash remains consistent between what was submitted to Shorebird and what's installed on device.

We also pinned the Flutter version using --flutter-version 3.29.3 when running shorebird release aar to avoid hash inconsistency caused by Shorebird CLI bundling a different Flutter version (3.44.0).

Regarding the App ID — we re-initialized Shorebird with a new app_id, that's why the old one is no longer visible in your system.

Everything is working now! Patch is being applied successfully on device.

Thanks again for the support!

marsh stirrupBOT
#

Great to hear!