When pressing the Android "Recent Apps" button (III), the app unexpectedly crashes.

Hi!

This looks like the same issue we are discussing on another thread. Can you take a look?

1 Like

I have already posted on Discord an issue I am suffering that I think its related to yours. When trying to publish a new app on Google Play I get rejected because they report me the app crashes. This app of mine uses no plugins, IAP, nor anything special. Also the same app has been published on ios.
I have tested on Android 15 & 8 and works with no problems.
But I have no Android 14 to test and see the issue my self.
If someone wants to test the app you can download from here: Unique Download Link | WeTransfer

Anyway, after reading your post gonna try with Solar2D 2023.3699

1 Like

It’s interesting that it starts happening from build 3700 onwards, because 3700 had a pretty critical fix for ANRs. Before that, it was very difficult to stay under Google Play’s bad behaviour threshold.

If I recall correctly, the “fix” was to kill the app if it was hanging for 4s - because Google Play (or maybe Android generally) only consider an app to be “not responding” if it hangs for 5s or more.

If this change is the cause of your app crashing, it would suggest that something is causing your app to freeze when it resumes (and as a result the above fix is killing the app). I would suggest plugging the phone into your computer and checking the logs for any errors that might point to the cause. I use this adb command to filter out all of the non-Solar2D parts of the log:

adb logcat Corona:V System.err:V System.out:V AndroidRuntime:V *:S

As suggested by @chodongwon82, I rebuilt my app using Solar2D 2023.3699 and got below error:
Could not find com.beust:klaxon:5.0.1.
So I replaced the below zip file with the latest version from Corona-3714 and was able to get rid of the issue!
/Applications/Corona-3699/Native/Corona/android/resource/android-template.zip

I haven’t been able to perform a full test on my app to determine if any other issues, but so far it appears to be working fine.

If something is causing the Hello World sample to crash, I fear it might be a core issue. It might be related to Controller like @clang suggested for a similar issue.

1 Like

This is a follow-up update.

I tried my game bilgi on an Android 14 Samsung device and used logcat to debug like @alanFlickGames suggested. My previous report on Discord was from Amazon QA testing it on Windows 11 Android emulation.

I’ll share the steps to reproduce, code, error dump and other things I noticed. Here:

Steps to reproduce:
1- Open the game.
2- Swipe up to see all apps working on the background. (Don’t send to background!)
3- Select the game again to bring it to full screen.
4- Crash!


CodeOpenBilgi/screens/menuScreen.lua at main · sekodev/OpenBilgi · GitHub


Error dump

02-04 02:06:12.582 10631 10678 V Corona  : > Class.forName: network.LuaLoader
02-04 02:06:12.582 10631 10678 V Corona  : < Class.forName: network.LuaLoader
02-04 02:06:12.582 10631 10678 V Corona  : Loading via reflection: network.LuaLoader
02-04 02:06:12.595 10631 10678 I Corona  : Platform: SM-F731B / ARM64 / 14 / Adreno (TM) 740 / OpenGL ES 3.2 V@0676.42 (GIT@7b26bdd942, Iab69c31769, 1693222181) (Date:08/28/23) / 2024.3710 / Türkçe | TR | tr_TR | tr
02-04 02:06:12.599 10631 10678 V Corona  : > Class.forName: shared.google.play.services.base.LuaLoader
02-04 02:06:12.603 10631 10678 V Corona  : > Class.forName: licensing.LuaLoader
02-04 02:06:12.605 10631 10678 V Corona  : > Class.forName: CoronaProvider.licensing.google.LuaLoader
02-04 02:06:12.605 10631 10678 V Corona  : < Class.forName: CoronaProvider.licensing.google.LuaLoader
02-04 02:06:12.607 10631 10678 V Corona  : Loading via reflection: CoronaProvider.licensing.google.LuaLoader
02-04 02:06:12.615 10631 10678 I Corona  : Default translation is set to defined value 'en'
02-04 02:06:14.034  4581  4726 I System.out: Broadcasting: Intent { act=com.sec.intent.action.CP_CHAN_INFO flg=0x1000000 (has extras) }
02-04 02:06:14.038  4581  4726 I System.out: Broadcast completed: result=0
02-04 02:06:15.758  4581  4636 I System.out: Broadcasting: Intent { act=com.sec.intent.action.CP_CHAN_INFO flg=0x1000000 (has extras) }
02-04 02:06:15.762  4581  4636 I System.out: Broadcast completed: result=0
02-04 02:06:26.241  2747  2909 W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.ComponentName.getPackageName()' on a null object reference
02-04 02:06:26.241  2747  2909 W System.err: 	at com.samsung.android.server.wifi.SemWifiOptimizer$6.noteResumeComponent(SemWifiOptimizer.java:19)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.server.usage.UsageStatsService$LocalService.reportEvent(UsageStatsService.java:3123)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.server.am.ActivityManagerService.updateActivityUsageStats(ActivityManagerService.java:3524)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.server.am.ActivityManagerService$LocalService.updateActivityUsageStatsWithIntent(ActivityManagerService.java:21166)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.server.wm.ActivityTaskManagerService$$ExternalSyntheticLambda26.accept(R8$$SyntheticClass:0)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:384)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:87)
02-04 02:06:26.241  2747  2909 W System.err: 	at android.os.Handler.handleCallback(Handler.java:958)
02-04 02:06:26.241  2747  2909 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 02:06:26.241  2747  2909 W System.err: 	at android.os.Looper.loopOnce(Looper.java:230)
02-04 02:06:26.241  2747  2909 W System.err: 	at android.os.Looper.loop(Looper.java:319)
02-04 02:06:26.241  2747  2909 W System.err: 	at android.os.HandlerThread.run(HandlerThread.java:67)
02-04 02:06:26.241  2747  2909 W System.err: 	at com.android.server.ServiceThread.run(ServiceThread.java:46)
02-04 02:06:26.242  2747  2909 W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.ComponentName.getPackageName()' on a null object reference
02-04 02:06:26.242  2747  2909 W System.err: 	at com.samsung.android.server.wifi.tcp.SemWifiTransportLayerMonitor$3.noteResumeComponent(SemWifiTransportLayerMonitor.java:69)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.server.usage.UsageStatsService$LocalService.reportEvent(UsageStatsService.java:3123)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.server.am.ActivityManagerService.updateActivityUsageStats(ActivityManagerService.java:3524)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.server.am.ActivityManagerService$LocalService.updateActivityUsageStatsWithIntent(ActivityManagerService.java:21166)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.server.wm.ActivityTaskManagerService$$ExternalSyntheticLambda26.accept(R8$$SyntheticClass:0)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:384)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:87)
02-04 02:06:26.242  2747  2909 W System.err: 	at android.os.Handler.handleCallback(Handler.java:958)
02-04 02:06:26.242  2747  2909 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 02:06:26.242  2747  2909 W System.err: 	at android.os.Looper.loopOnce(Looper.java:230)
02-04 02:06:26.242  2747  2909 W System.err: 	at android.os.Looper.loop(Looper.java:319)
02-04 02:06:26.242  2747  2909 W System.err: 	at android.os.HandlerThread.run(HandlerThread.java:67)
02-04 02:06:26.242  2747  2909 W System.err: 	at com.android.server.ServiceThread.run(ServiceThread.java:46)
02-04 02:06:26.676  2747  4203 W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.ComponentName.getPackageName()' on a null object reference
02-04 02:06:26.676  2747  4203 W System.err: 	at com.samsung.android.server.wifi.tcp.SemWifiTransportLayerMonitor.getCurrentPackageInfo(SemWifiTransportLayerMonitor.java:15)
02-04 02:06:26.676  2747  4203 W System.err: 	at com.samsung.android.server.wifi.tcp.SemWifiSwitchForIndividualAppsService.handleMessage(SemWifiSwitchForIndividualAppsService.java:52)
02-04 02:06:26.676  2747  4203 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
02-04 02:06:26.676  2747  4203 W System.err: 	at android.os.Looper.loopOnce(Looper.java:230)
02-04 02:06:26.676  2747  4203 W System.err: 	at android.os.Looper.loop(Looper.java:319)
02-04 02:06:26.677  2747  4203 W System.err: 	at android.os.HandlerThread.run(HandlerThread.java:67)
02-04 02:06:47.293  2747  4292 W System.err: java.io.FileNotFoundException: /proc/10631/io_record_control: open failed: ENOENT (No such file or directory)
02-04 02:06:47.299  2747  4292 W System.err: 	at libcore.io.IoBridge.open(IoBridge.java:574)
02-04 02:06:47.300  2747  4292 W System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:259)
02-04 02:06:47.300  2747  4292 W System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:208)
02-04 02:06:47.300  2747  4292 W System.err: 	at java.io.FileWriter.<init>(FileWriter.java:96)
02-04 02:06:47.300  2747  4292 W System.err: 	at com.android.server.am.Pageboost$IoRecord.write(Pageboost.java:1711)
02-04 02:06:47.300  2747  4292 W System.err: 	at com.android.server.am.Pageboost$IoRecord.getResultFromKernel(Pageboost.java:1935)
02-04 02:06:47.300  2747  4292 W System.err: 	at com.android.server.am.Pageboost$PageboostHandler.handleMessage(Pageboost.java:2463)
02-04 02:06:47.300  2747  4292 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
02-04 02:06:47.300  2747  4292 W System.err: 	at android.os.Looper.loopOnce(Looper.java:230)
02-04 02:06:47.300  2747  4292 W System.err: 	at android.os.Looper.loop(Looper.java:319)
02-04 02:06:47.300  2747  4292 W System.err: 	at android.os.HandlerThread.run(HandlerThread.java:67)
02-04 02:06:47.300  2747  4292 W System.err: 	at com.android.server.ServiceThread.run(ServiceThread.java:46)
02-04 02:06:47.301  2747  4292 W System.err: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
02-04 02:06:47.301  2747  4292 W System.err: 	at libcore.io.Linux.open(Native Method)
02-04 02:06:47.301  2747  4292 W System.err: 	at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
02-04 02:06:47.301  2747  4292 W System.err: 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
02-04 02:06:47.301  2747  4292 W System.err: 	at libcore.io.IoBridge.open(IoBridge.java:560)
02-04 02:06:47.301  2747  4292 W System.err: 	... 11 more

What else I noticed:

  • When you navigate through open apps in the background but don’t switch, the game is still running and the music can still be heard, but it stops after a few (4?) seconds because the game crashes.
  • In the ‘Recent Apps’ screen, switch to another app and the music can still be heard. The game is not being sent to background.
  • Send the app directly to the background and bring it back, it doesn’t crash.
  • I tried @alanFlickGames Flick Solitaire. The same behavior applies. It crashes.
  • I followed the same steps with Candy Crush Saga to see how other engines/frameworks behave. In this case, the game audio is immediately paused when ‘Recent Apps’ screen is on screen. Game doesn’t crash.

Conclusion:
I believe Solar2D framework is not pausing the application or the sound layer properly when the user opens the ‘Recent Apps’ (or say, switch between apps UI). As @chodongwon82 reported, the behavior might vary between Samsung and other Android devices but this is definitely not handled the right away on Android 14 Samsung devices and it’s not working right on Android emulation for Windows 11(Amazon App Store).

I’ll put all of this together and create an issue on Github repo, hopefully tomorrow.

1 Like

I’ve added this as an issue on GitHub.

2 Likes

Thanks. GitHub issues are very good at tracking bugs. Looking into it

4 Likes

Interestingly, the problem doesn’t happen as long as the multitasking manager doesn’t pause the app, such as Google Pixel with Android 14/15, which you might want to keep in mind when trying to reproduce.

And the problem should be that the App actively exits rather than crashes, you can use bugreport to get a report after the reproduced and see if there is a record, it should not be marked as a crash. This can be partially confirmed by the fact that from about 3700 onwards, the ANR decreases while the crash rate does not increase. So you can check if there are other issues, or maybe Google Play is using the word crash incorrectly?

Not sure if this helps but I’ve noticed after a build leaving the simulator log connected.

It will echo
**layUi called on unknown pid: **
into the corona sim console just before it dies.

1 Like

See build

Thank you @Scott_Harrison
Thanks to you, the issue has been resolved.
However, I have some additional findings to report.

Build 2025.3715

  1. Redmi Note (android13) → No issues found
  2. Samsung Galaxy S24 Ultra (android14) → The issue has been resolved :slight_smile:
  3. Samsung Galaxy S25 (android15) → The issue is still occurring!

I recently bought a phone released three days ago with Android 15 pre-installed, so I was able to test it today.

Yeah the build only targets Android 14 with the fix,

I tried on my Pixel running Android 15 and it does not seem to crash. Guessing it maybe a Samsung power saving thing?
Will try the fix on my Pixel 15 device and if it does not cause any weirdness will increase it android 14 >=

See new pull request

I was a bit busy and just got back. I have now tested it today with Build 2025.3717, and everything worked perfectly. The test devices used were S24 Ultra (Android 14) and S25 (Android 15). :kissing_heart:

After updating to build “Solar2D 2025.3717,” the number of crash reports has increased significantly. However, strangely, there are no user reviews mentioning crashes. On the contrary, I even received an updated 5-star review stating that the issue of the app closing on Samsung phones has been fixed since this patch. It’s quite confusing.

Odd, What do your crash logs say?


I will attach the top crash logs below.

[base.apk] com.ansca.corona.JavaToNativeShim.render
Stack trace
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 16686 >>> com.gmail.myappname.cho <<<

backtrace:
  #00  pc 0x000000000017a80c  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #01  pc 0x0000000000186ca0  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #02  pc 0x000000000010247c  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #03  pc 0x00000000000e630c  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #04  pc 0x00000000001729a8  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #05  pc 0x0000000000333adc  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+108)
  #06  pc 0x000000000078080c  /apex/com.android.art/lib64/libart.so (nterp_helper+1948)
  #07  pc 0x00000000004bffe6  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/base.apk (com.ansca.corona.JavaToNativeShim.render+26)
  #08  pc 0x0000000002135544  /memfd:jit-cache (com.ansca.corona.Controller.updateRuntimeState+1156)
  #09  pc 0x0000000000780108  /apex/com.android.art/lib64/libart.so (nterp_helper+152)
  #10  pc 0x00000000004cd798  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/base.apk (com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame+8)
  #11  pc 0x000000000215b524  /memfd:jit-cache (com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun+2436)
  #12  pc 0x0000000000780fc4  /apex/com.android.art/lib64/libart.so (nterp_helper+3924)
  #13  pc 0x00000000004cf4ae  /data/app/~~eZ3pVGO1f6TZHdqxQ4RFGg==/com.gmail.myappname.cho-tq3qA1IoJbE-U7SqSELSwA==/base.apk (com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run+42)
  #14  pc 0x0000000000368774  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612)
  #15  pc 0x0000000000353f04  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+132)
  #16  pc 0x0000000000947a48  /apex/com.android.art/lib64/libart.so (art::detail::ShortyTraits<(char)86>::Type art::ArtMethod::InvokeInstance<(char)86>(art::Thread*, art::ObjPtr<art::mirror::Object>, art::detail::ShortyTraits<>::Type...)+60)
  #17  pc 0x000000000061afcc  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1344)
  #18  pc 0x000000000061aa7c  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallbackWithUffdGc(void*)+8)
  #19  pc 0x00000000000bea28  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #20  pc 0x000000000005b3b0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
[split_config.arm64_v8a.apk!libcorona.so]
Stack trace
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 21545 >>> com.gmail.myappname.cho <<<

backtrace:
  #00  pc 0x0000000000186d20  /data/app/~~Z24weDJsTsSaVBO-4iAbfQ==/com.gmail.myappname.cho-41qjyWpJ29cReJEhXsHCWg==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #01  pc 0x0000000000102458  /data/app/~~Z24weDJsTsSaVBO-4iAbfQ==/com.gmail.myappname.cho-41qjyWpJ29cReJEhXsHCWg==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #02  pc 0x00000000000e630c  /data/app/~~Z24weDJsTsSaVBO-4iAbfQ==/com.gmail.myappname.cho-41qjyWpJ29cReJEhXsHCWg==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #03  pc 0x00000000001729a8  /data/app/~~Z24weDJsTsSaVBO-4iAbfQ==/com.gmail.myappname.cho-41qjyWpJ29cReJEhXsHCWg==/split_config.arm64_v8a.apk!libcorona.so (BuildId: d26bb69b1f50efe833855dbae10fc1f1b85c9802)
  #04  pc 0x0000000000333adc  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+108)
  #05  pc 0x00000000003433b4  /data/app/~~Z24weDJsTsSaVBO-4iAbfQ==/com.gmail.myappname.cho-41qjyWpJ29cReJEhXsHCWg==/oat/arm64/base.odex (com.ansca.corona.Controller.updateRuntimeState+1780)
  #06  pc 0x0000000000360910  /data/app/~~Z24weDJsTsSaVBO-4iAbfQ==/com.gmail.myappname.cho-41qjyWpJ29cReJEhXsHCWg==/oat/arm64/base.odex (com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun+3024)
  #07  pc 0x0000000000361698  /data/app/~~Z24weDJsTsSaVBO-4iAbfQ==/com.gmail.myappname.cho-41qjyWpJ29cReJEhXsHCWg==/oat/arm64/base.odex (com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run+312)
  #08  pc 0x000000000036d574  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612)
  #09  pc 0x0000000000358bc0  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+132)
  #10  pc 0x0000000000944608  /apex/com.android.art/lib64/libart.so (art::detail::ShortyTraits<(char)86>::Type art::ArtMethod::InvokeInstance<(char)86>(art::Thread*, art::ObjPtr<art::mirror::Object>, art::detail::ShortyTraits<>::Type...)+60)
  #11  pc 0x0000000000625d24  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1344)
  #12  pc 0x00000000006257d4  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallbackWithUffdGc(void*)+8)
  #13  pc 0x00000000000cba28  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
  #14  pc 0x00000000000683b0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)