Provide a more helpful error message in the case of UnsatisfiedLinkError (flutter/engine#50247)
Related https://github.com/flutter/flutter/issues/83596
This commit is contained in:
@@ -142,7 +142,20 @@ public class FlutterJNI {
|
||||
Log.w(TAG, "FlutterJNI.loadLibrary called more than once");
|
||||
}
|
||||
|
||||
System.loadLibrary("flutter");
|
||||
try {
|
||||
System.loadLibrary("flutter");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
// Sniff if this because libflutter.so couldn't be found.
|
||||
if (e.toString().contains("couldn't find \"libflutter.so\"")) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Could not load libflutter.so this is likely 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.",
|
||||
e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
FlutterJNI.loadLibraryCalled = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user