[Interest] Qt/JNI blows up on android when activity is closed

Jason H jhihn at gmx.com
Tue Mar 22 15:17:44 CET 2016


As my app's tendrils root further into the mobile OSs, I've found one very troubling issue. I have an alarm manager and a service to handle the pending intent. The service talks to Qt through JNI. This works for as long as my Qt Activity exists. However if the activity is closed (user task kills it) the service keeps running (as it should) but then the native JNI functions stop working.

I'm thinking we should be able to associate the native functions with the application, or a default service so that the native functions always exist?
Is there a way to prevent this? Logs below. This does work until the activity is killed.

D/Recents_TaskStackView( 2989): onStackTaskRemoved Task=Task (no group): com.app.a [com.android.systemui.recents.model.Task at 33d63ca2]
D/Recents_TaskStackView( 2989): getChildViewForTask t=Task (no group): com.app.a [com.android.systemui.recents.model.Task at 33d63ca2]
V/ApplicationPolicy(  784): isApplicationStateBlocked userId 0 pkgname com.app.a
I/WindowState(  784): WIN DEATH: Window{1d9235ab u0 com.app.a/com.app.MyActivity}
W/WindowManager(  784): Force-removing child win Window{18d9c46a u0 SurfaceView} from container Window{1d9235ab u0 com.app.a/com.app.MyActivity}
I/ActivityManager(  784): Process com.app.a (pid 23416)(adj 0) has died(100,423)
W/ActivityManager(  784): Scheduling restart of crashed service com.app.a/com.app.ServerService in 1000ms
I/ActivityManager(  784): Start proc com.app.a for service com.app.a/com.app.a.ServerService: pid=26206 uid=10246 gids={50246, 9997, 3003, 1028, 1015} abi=armeabi-v7a
D/app ServerServiceTask(26206): created
D/app ServerServiceTask(26206): onStartCommand
D/app ServerServiceTask(26206): sendBackgroundChunk running...
E/art     (26206): No implementation found for boolean com.app.MyApplication.ready() (tried Java_com_app_MyApplication_ready and Java_com_app_MyApplication_ready__)
E/AndroidRuntime(26206): Process: com.app.a, PID: 26206
E/AndroidRuntime(26206): Caused by: java.lang.UnsatisfiedLinkError: No implementation found for boolean com.app.MyApplication.ready() (tried Java_com_app_MyApplication_ready and Java_com_app_MyApplication_ready__)
E/AndroidRuntime(26206): 	at com.app.MyApplication.ready(Native Method)
E/AndroidRuntime(26206): 	at com.app.ServerService$SyncServerTask.doInBackground(ServerService.java:55)
E/AndroidRuntime(26206): 	at com.app.ServerService$SyncServerTask.doInBackground(ServerService.java:50)

... eventually ...

W/ActivityManager(  784): Process com.app.a has crashed too many times: killing!
I/ActivityManager(  784): Killing 27664:com.app.a/u0a246 (adj 0): crash
D/CrashAnrDetector(  784): processName: com.app.a
D/CrashAnrDetector(  784): broadcastEvent : com.app.a data_app_crash
W/ActivityManager(  784): Unable to launch app com.app.a/10246 for service Intent { cmp=com.app.a/com.app.ServerService }: process is bad

... last line repeats forever ...




More information about the Interest mailing list