More logs for Android unsatisfiedLinkError (flutter/engine#53920)
See https://github.com/flutter/flutter/issues/83596#issuecomment-2140605278, there are two cases: 1. IO issue 2. The directory doesn't exist Narrow down by including in the logs if the directory exists or not. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
4cf29c3de0
commit
29a474fe3e
@ -207,8 +207,11 @@ public class FlutterLoader {
|
||||
+ cpuArch
|
||||
+ ", and the native libraries directory (with path "
|
||||
+ nativeLibsDir.getAbsolutePath()
|
||||
+ ") contains the following files: "
|
||||
+ Arrays.toString(nativeLibsContents),
|
||||
+ ") "
|
||||
+ (nativeLibsDir.exists()
|
||||
? "contains the following files: "
|
||||
+ Arrays.toString(nativeLibsContents)
|
||||
: "does not exist."),
|
||||
unsatisfiedLinkError);
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@Config(manifest = Config.NONE)
|
||||
@ -61,6 +62,25 @@ public class FlutterLoaderTest {
|
||||
verify(mockFlutterJNI, times(1)).updateRefreshRate();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unsatisfiedLinkErrorPathDoesNotExist() {
|
||||
FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
|
||||
ctx.getApplicationInfo().nativeLibraryDir = "/path/that/doesnt/exist";
|
||||
FlutterLoader flutterLoader = new FlutterLoader(mockFlutterJNI);
|
||||
|
||||
Mockito.doThrow(new UnsatisfiedLinkError("couldn't find \"libflutter.so\""))
|
||||
.when(mockFlutterJNI)
|
||||
.loadLibrary();
|
||||
try {
|
||||
flutterLoader.startInitialization(ctx);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
assertTrue(
|
||||
e.getMessage()
|
||||
.contains(
|
||||
"and the native libraries directory (with path /path/that/doesnt/exist) does not exist."));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itDefaultsTheOldGenHeapSizeAppropriately() {
|
||||
FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
|
||||
|
Loading…
x
Reference in New Issue
Block a user