Skip to content

Conversation

@mboetger
Copy link
Contributor

Increase logging around libflutter.so. This adds debug logging to the ReLinker load call as well as more logging in the error case. The split and source dirs are added to the error message to improve troubleshooting in the app bundle case. This does not fix the error of not finding the libflutter.so file, just increases logging to hopefully help devs find their problem.

Also, this fixes the unit tests which were not correctly getting the exception in the given test.

Fixes: #168272

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added platform-android Android applications specifically engine flutter/engine related. See also e: labels. labels May 12, 2025
@mboetger mboetger requested a review from a team May 12, 2025 23:28
@reidbaker reidbaker requested a review from jtmcdole May 13, 2025 14:24
@reidbaker
Copy link
Contributor

For my own understanding can you give an example log output that might change what this code does to fix the issue?
Are we hoping that the libraries are there but in an unexpected path? or are we hoping to show that the libraries are not there and that this is a tooling issue in apk delivery or something else?

@mboetger
Copy link
Contributor Author

For my own understanding can you give an example log output that might change what this code does to fix the issue? Are we hoping that the libraries are there but in an unexpected path? or are we hoping to show that the libraries are not there and that this is a tooling issue in apk delivery or something else?

For an app bundle, the output will look something like this

05-12 16:21:04.470 16731 16731 E FlutterLoader: App is using cpu architecture: aarch64, and the native libraries directory (with path /data/app/~~s0585eApe59QLdC1zYUiiw==/com.example.flutter_app_20250425_06-h2hMrlqiR3GGfRT_VRtbWw==/lib/arm64) contains the following files: [], and the split and source libraries directory (with path(s) [/data/app/~~s0585eApe59QLdC1zYUiiw==/com.example.flutter_app_20250425_06-h2hMrlqiR3GGfRT_VRtbWw==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/~~s0585eApe59QLdC1zYUiiw==/com.example.flutter_app_20250425_06-h2hMrlqiR3GGfRT_VRtbWw==/split_config.en.apk!/lib/arm64-v8a, /data/app/~~s0585eApe59QLdC1zYUiiw==/com.example.flutter_app_20250425_06-h2hMrlqiR3GGfRT_VRtbWw==/split_config.xxhdpi.apk!/lib/arm64-v8a, /data/app/~~s0585eApe59QLdC1zYUiiw==/com.example.flutter_app_20250425_06-h2hMrlqiR3GGfRT_VRtbWw==/base.apk!/lib/arm64-v8a]).

I went back and forth on whether it was worth reading the archived file contents in the apks - at that point, we'd basically be re-writing ReLinker. The first reason to do this is to give a more complete picture of where we are actually looking for the library. As the exception today states that it's only looking in the native library directory - which is not the full picture. I believe the benefit is to look for CPU architecture inconsistencies (for some reason if the phone is reporting the incorrect CPU arch - which seems to be the leading hypothesis as to why sometimes the libflutter.so file cannot be found in bundled installs).

Copy link
Member

@gmackall gmackall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this fixes the unit tests which were not correctly getting the exception in the given test.

Oof thanks for fixing, in hindsight I don't know why I wrote the expect within a catch block instead of just capturing the value in the catch block and asserting outside of the block.

Copy link
Member

@jtmcdole jtmcdole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm-seinfeld

@mboetger mboetger added the autosubmit Merge PR when tree becomes green via auto submit App label May 13, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 14, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented May 14, 2025

autosubmit label was removed for flutter/flutter/168706, because - The status or check suite Linux linux_web_engine_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mboetger mboetger added the autosubmit Merge PR when tree becomes green via auto submit App label May 14, 2025
@jtmcdole
Copy link
Member

Looks like engine artifacts are completed (at least for the last sha). I'll look at logs for FRoB

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 15, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented May 15, 2025

autosubmit label was removed for flutter/flutter/168706, because - The status or check suite Linux linux_fuchsia_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mboetger mboetger added the autosubmit Merge PR when tree becomes green via auto submit App label May 15, 2025
@auto-submit auto-submit bot added this pull request to the merge queue May 15, 2025
Merged via the queue into flutter:master with commit bb2c346 May 16, 2025
179 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-android Android applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Misleading message when loadLibrary throws UnsatisfiedLinkError with app bundle

4 participants