Do not define JNI_OnLoad for Windows
HostRuntime should only be used when libandroid_runtime is the entry
point for JNI. Windows is only supported for Layoutlib, which uses
layoutlib_jni as its JNI entry point. That is not an issue for Linux or
macOS, as for those platforms we load layoutlib_jni from the JVM, and
the system takes care of loading its native dependencies (like
libandroid_runtime). However, this does not work on Windows, and we need
to load each dependency explicitly. Loading libandroid_runtime
explicitly triggers its JNI_OnLoad method, which we do not want as it
conflicts with the one then run when loading layoutlib_jni.
Thus we ignore the definition of JNI_OnLoad when compiling
libandroid_runtime on Windows.
Flag: NONE host-only change
Bug: 74062470
Test: run layoutlib on Windows
Change-Id: Icfb75aeb349bbb5ed93495bfea36217a8a44393c
1 file changed