Android: fix order of calling setApplicationState() in QtServiceBase

In QtServiceBase setApplicationState() is being called before
the Qt libs are loaded and that call invokes a native method,
so that leads to a crash/exception for UnsatisfiedLinkError.

Pick-to: 6.7
Change-Id: I879d120f0cc2985ab49f7402a65f171950451914
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Janne Juntunen <janne.juntunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
bb10
Assam Boudjelthia 2023-12-18 15:19:24 +02:00
parent ec7b4d547d
commit f292a66904
1 changed files with 1 additions and 2 deletions

View File

@ -14,8 +14,6 @@ public class QtServiceBase extends Service {
{
super.onCreate();
QtNative.setApplicationState(QtNative.ApplicationState.ApplicationHidden);
// the application has already started, do not reload everything again
if (QtNative.getStateDetails().isStarted) {
Log.w(QtNative.QtTAG,
@ -28,6 +26,7 @@ public class QtServiceBase extends Service {
QtServiceLoader loader = new QtServiceLoader(this);
loader.loadQtLibraries();
QtNative.startApplication(loader.getApplicationParameters(), loader.getMainLibrary());
QtNative.setApplicationState(QtNative.ApplicationState.ApplicationHidden);
}
@Override