Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a19127a1 authored by Jerome Gaillard's avatar Jerome Gaillard
Browse files

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
parent cc5bebfe
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -391,6 +391,7 @@ public:

} // namespace android

#ifndef _WIN32
using namespace android;

JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
@@ -407,3 +408,4 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {

    return JNI_VERSION_1_6;
}
#endif