When App Crashes, Debug Screen no longer shows with error
If my app crashes, Debug activity doesn't come up anymore so I don't know what the error message is. And I can't use logcat because I don't have root.
FYI: You can use a logcat reader without root access or a computer if you're on Android 11 or higher. Try one of those logcat apps on Google Play, or use Shizuku and Termux to access the system binary directly.
Okay I check it out. Why doesn't the DebugActivity show anymore when there's a crash though? Can it be fixed?
It was never there by default. You can create a new activity with that name then It'll be called automatically when a crash happens.
Well back in the past I specifically remember it would always show the crash log after a crash. It just doesn't do that anymore.
On Thu, May 30, 2024, 8:30 AM Ilyasse @.***> wrote:
It was never there by default. You can create a new activity with that name then It'll be called automatically when a crash happens.
— Reply to this email directly, view it on GitHub https://github.com/Sketchware-Pro/Sketchware-Pro/issues/1140#issuecomment-2139451341, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3NVF4QDCQZQHADAVI53PDZE4LVNAVCNFSM6AAAAABIP4MX3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZZGQ2TCMZUGE . You are receiving this because you authored the thread.Message ID: @.***>
It used to show a dialog with the full crash log that you could then copy, but now when an app crashes, it just shows a blank screen.
Whenever apps don't show the stack trace like that, going to the home screen, opening Recents, opening the app again from there, and combos of that often help, at least for me. Maybe try that.
This seems hard to fix, and the issue of the dialog not showing has been there forever. Newer Android versions probably introduced limits which made the chance of that happening much higher.
Whenever apps don't show the stack trace like that, going to the home screen, opening Recents, opening the app again from there, and combos of that often help, at least for me. Maybe try that.
This seems hard to fix, and the issue of the dialog not showing has been there forever. Newer Android versions probably introduced limits which made the chance of that happening much higher.
Yeah, that's what I started doing months back but now that I updated to Android 14, the error message rarely shows up. It's like a 5% chance that I'll get to see the error message. Most of the time, the app will just freeze up or crash now without any error message. There has to be some way to fix it. Error messages used to be extremely helpful.
You can't just copy-paste code freely while ignoring the license.
Maybe it's time we update/fix the default crash handler. This code below works for my app every time, I'll try to port it to SKPro if I get an upvote (from mods)
class ApplicationClass : Application() {
override fun onCreate() {
super.onCreate()
Thread.setDefaultUncaughtExceptionHandler { _: Thread?, throwable: Throwable? ->
val intent = Intent(applicationContext, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
intent.putExtra("stacktrace", Log.getStackTraceString(throwable))
startActivity(intent)
Process.killProcess(Process.myPid())
exitProcess(1)
}
}
}
In MainActivity
//Any crash logs sent via DefaultUncaughtExceptionHandler
intent.getStringExtra("stacktrace")?.let { eventLog("Application Crashed", it) }
LocalBroadcastManager.getInstance(this).registerReceiver(
eventLogBroadcastReceiver,
IntentFilter("eventLog")
)
Maybe it's time we update/fix the default crash handler. This code below works for my app every time, I'll try to port it to SKPro if I get an upvote
class ApplicationClass : Application() { override fun onCreate() { super.onCreate() Thread.setDefaultUncaughtExceptionHandler { _: Thread?, throwable: Throwable? -> val intent = Intent(applicationContext, MainActivity::class.java) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK intent.putExtra("stacktrace", Log.getStackTraceString(throwable)) startActivity(intent) Process.killProcess(Process.myPid()) exitProcess(1) } } }In MainActivity
//Any crash logs sent via DefaultUncaughtExceptionHandler intent.getStringExtra("stacktrace")?.let { eventLog("Application Crashed", it) } LocalBroadcastManager.getInstance(this).registerReceiver( eventLogBroadcastReceiver, IntentFilter("eventLog") )
Yes fix it! Do it!
@guhg Please test with https://github.com/Sketchware-Pro/Sketchware-Pro/actions/runs/9328652398
@guhg Please test with https://github.com/Sketchware-Pro/Sketchware-Pro/actions/runs/9328652398
I tried it! Works wonders!