I have Non-UI app which uses a lot of KVSs. I want to close them when the app closes. I tried to use Erel's method described here. But it throws the following error during compilation:
B4X:
main._appstart (java line: 44)
java.lang.RuntimeException: Method: addShutdownHook not found in: b4j.example.main
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
at b4j.example.main._appstart(main.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:28)
Tested with Java 8, 11, 14 - result is the same. What I'm doing wrong?
I have Non-UI app which uses a lot of KVSs. I want to close them when the app closes. I tried to use Erel's method described here. But it throws the following error during compilation:
B4X:
main._appstart (java line: 44)
java.lang.RuntimeException: Method: addShutdownHook not found in: b4j.example.main
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
at b4j.example.main._appstart(main.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at...
I have Non-UI app which uses a lot of KVSs. I want to close them when the app closes. I tried to use Erel's method described here. But it throws the following error during compilation:
B4X:
main._appstart (java line: 44)
java.lang.RuntimeException: Method: addShutdownHook not found in: b4j.example.main
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
at b4j.example.main._appstart(main.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:28)
Tested with Java 8, 11, 14 - result is the same. What I'm doing wrong?