Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3
-
None
-
Android 6
Description
For example, we have an application with Java Service. Both the main activity and the Service linked to the same `.so` library, but the Service has an additional arguments to the `.so` library at the `AndroidManifest.xml`.
So, when the main application and the Service are closed and we run the Java Service by external trigger, for example by phone call we see the following actions:
- The Java Service is started
- It loads the `.so` library
- The `JNI_OnLoad()` function is called at the `.so` library and we register Java native methods by using `JNIEnv::RegisterNatives()` method
- The `main()` function is called at the `.so` library
- After several seconds we call a native method from Java side
- We get the `java.lang.UnsatisfiedLinkError: No implementation found for...` error
But when we call the `System.loadLibrary()` method from Java side we see the following actions:
- The Java Service is started
- It loads the `.so` library
- The `JNI_OnLoad()` function is called at the `.so` library and we register Java native methods by using `JNIEnv::RegisterNatives()` method
- The `main()` function is called at the `.so` library
- We call the `System.loadLibrary()` method from Java side
- The `JNI_OnLoad()` function is called at the `.so` library and we register Java native methods by using `JNIEnv::RegisterNatives()` method
- The `main()` function is NOT called at the `.so` library. And it is a problem.
- After several seconds we call a native method from Java side
- The native method is called at C++ side, but because the `main()` function was not called the `qApp` is null and we do not have Qt main event loop here. And it is a problem.
Related bug report: https://bugreports.qt.io/browse/QTBUG-68813