fix(android): pickFirsts libc++_shared.so to unblock multi-plugin Flet apps#6571
Open
ndonkoHenri wants to merge 6 commits into
Open
fix(android): pickFirsts libc++_shared.so to unblock multi-plugin Flet apps#6571ndonkoHenri wants to merge 6 commits into
pickFirsts libc++_shared.so to unblock multi-plugin Flet apps#6571ndonkoHenri wants to merge 6 commits into
Conversation
…t apps
Gradle's mergeNativeLibs task aborts when more than one input
contributes a file at the same path. serious_python_android (the
Python runtime shipped via mobile-forge wheels) bundles
libc++_shared.so because cross-compiled wheels link against it;
many third-party Flutter plugins (ultralytics_yolo, sentry_flutter,
several ML/CV/audio plugins) ship their own copy too. The clash
surfaces as
> N files found with path 'lib/<abi>/libc++_shared.so' from inputs:
- .../<plugin_a>/.../libc++_shared.so
- .../serious_python_android/.../libc++_shared.so
and breaks any Flet app that combines flet-libcpp-shared-backed
wheels with a third-party plugin that also bundles libc++_shared.so
(reported in #6570 for a YOLO + opencv-python app).
libc++_shared.so is the NDK's shared C++ runtime, and the NDK has
held strict ABI compatibility on it since r17 (June 2018). Whichever
copy wins Gradle's input ordering, every consumer that linked
against libc++_shared will work against it -- which makes pickFirsts
the documented, narrowly-scoped escape hatch for this specific
collision. The directive is glob-scoped to **/libc++_shared.so so
any other future duplicate-native-lib clash still fails loudly
rather than getting silently masked.
Resolves the runtime crash / build failure in #6570; verified
working by the reporter via a local one-line edit before this
landed.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR unblocks Android builds for multi-plugin Flet apps by adjusting the generated Android Gradle template to resolve duplicate libc++_shared.so conflicts during mergeDebugNativeLibs, and it updates the website release-notes index to link to missing changelog sections.
Changes:
- Add
packaging.jniLibs.pickFirstsfor**/libc++_shared.soin the generatedandroid/app/build.gradle.ktsto avoid duplicate-native-lib merge failures. - Add a
0.85.4changelog entry describing the Android build fix. - Add missing release-notes links for
0.85.4,0.85.3,0.85.2,0.1.53, and0.1.46.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
sdk/python/templates/build/{{cookiecutter.out_dir}}/android/app/build.gradle.kts |
Adds a narrowly-scoped pickFirsts rule to prevent Gradle native lib merge failures from duplicate libc++_shared.so. |
CHANGELOG.md |
Documents the new 0.85.4 bug fix entry for the Android packaging change. |
website/docs/updates/release-notes.md |
Adds missing links to the relevant changelog anchors for recently added and previously skipped versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #6570 —
flet build apk/flet debug androidfails atmergeDebugNativeLibswithN files found with path 'lib/<abi>/libc++_shared.so'whenever an app combinesserious_python_android(Flet's Python runtime — bundleslibc++_shared.sobecause the pypi.flet.dev wheels link against it) with any third-party Flutter plugin that also ships its own copy (e.g.ultralytics_yolo,sentry_flutter, several ML / CV / audio plugins).Adds
pickFirsts += listOf("**/libc++_shared.so")to the existingpackaging.jniLibs { }block in the generatedandroid/app/build.gradle.kts. AGP then picks whichever copy wins input ordering and discards the rest. Safe specifically here because the NDK has held strict ABI compatibility onlibc++_shared.sosince r17 — any consumer that linked against it works against any version. The glob is narrowly scoped, so any other future duplicate-native-lib clash still fails loudly rather than getting silently masked.Also catches up on missing release-notes links: 0.85.2, 0.85.3, 0.85.4 (new), plus 0.1.46 and 0.1.53 (older entries that were skipped because their CHANGELOG headings are linkified).
Summary by Sourcery
Resolve Android APK build failures caused by duplicate libc++_shared.so when combining the Flet Python runtime with certain Flutter plugins, and update release notes links for recent and older versions.
Bug Fixes:
Documentation: