This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add more logging for UnsatisfiedLinkError #51534
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
79b2bd8
wipundomepleasethanksgray
d6445a1
logging
22f9cfa
format
f68a7fd
Merge branch 'flutter:main' into unsatisfied_link_logging
gmackall 8888c31
logging
4fb3722
remove personal log
4d0494f
don't assume the files are all .so files
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,7 +182,37 @@ public InitResult call() { | |
| try (TraceSection e = TraceSection.scoped("FlutterLoader initTask")) { | ||
| ResourceExtractor resourceExtractor = initResources(appContext); | ||
|
|
||
| flutterJNI.loadLibrary(); | ||
| try { | ||
| flutterJNI.loadLibrary(); | ||
| } catch (UnsatisfiedLinkError unsatisfiedLinkError) { | ||
| String couldntFindVersion = "couldn't find \"libflutter.so\""; | ||
| String notFoundVersion = "dlopen failed: library \"libflutter.so\" not found"; | ||
|
|
||
| if (unsatisfiedLinkError.toString().contains(couldntFindVersion) | ||
| || unsatisfiedLinkError.toString().contains(notFoundVersion)) { | ||
| // To gather more information for | ||
| // https://github.com/flutter/flutter/issues/144291, | ||
| // log the contents of the native libraries directory as well as the | ||
| // cpu architecture. | ||
|
|
||
| String cpuArch = System.getProperty("os.arch"); | ||
| String[] nativeLibs = new File(flutterApplicationInfo.nativeLibraryDir).list(); | ||
|
|
||
| throw new UnsupportedOperationException( | ||
| "Could not load libflutter.so this is possibly because the application" | ||
| + " is running on an architecture that Flutter Android does not support (e.g. x86)" | ||
| + " see https://docs.flutter.dev/deployment/android#what-are-the-supported-target-architectures" | ||
| + " for more detail.\n" | ||
| + "App is using cpu architecture: " | ||
| + cpuArch | ||
| + ", and the native libraries directory contains the following files: " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you include the native library directory path in this message? Or if the files in nativeLibs are absolute paths that no need to do that.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't see this before the merge, sorry. The files aren't shown as absolute paths, I'll put up a quick follow up to print the path too |
||
| + Arrays.toString(nativeLibs), | ||
| unsatisfiedLinkError); | ||
| } | ||
|
|
||
| throw unsatisfiedLinkError; | ||
| } | ||
|
|
||
| flutterJNI.updateRefreshRate(); | ||
|
|
||
| // Prefetch the default font manager as soon as possible on a background thread. | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you filter this list down to just files that end with .so or change the message below on line 208?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change the message to
the following files(I suppose I was assuming only .so files end up there because thats all I saw when I tested it, but that is probably a bad assumption)