[TIMOB-26759] Android: If an app is killed and relaunches, it stucks on the splash-screen (SDK 8+)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Unknown |
Created | 2019-01-21T14:00:54.000+0000 |
Updated | 2019-01-23T22:12:27.000+0000 |
Description
If an Android app is killed and relaunches, it stucks on the splash-screen. This can be seen on SDK 8+ by provocating a runtime error.
I'm not sure what you mean. Are you talking about the error dialog Titanium displays when a JavaScript exception occurs? Is that the "Kill" button you are referring to? Because that will simply terminate the app. When you start up the app afterwards, it'll start up fine because it's a cold start. And I can kill the app via Android's task manager and restart the app just fine too. This works fine because it's doing a cold start too. Perhaps you are referring to tapping the exception dialog's "Continue" button? If you do that, then you may be continuing the app's JavaScript or Java side is in a broken state.
*Side Note:* The only thing I know that will cause the splash to hang on startup is if a Java exception occurs within the
Application.onCreate()
orActivity.onCreate()
methods, because that'll put Google activity UI in a broken state. This typically only happens if there is an issue with a Java module. For example, the "ti.facebook" module will throw an exception on app startup if you haven't added your app ID to the "AndroidManifest.xml" and "strings.xml". This exception occurs within Facebook's library (they did it on purpose and works like a C/C++ assert).Thanks for jumping on this Josh! I don't remember which exception caused this, but it can be in some kind of Window "open" event. Since it's development only, it's not really a blocker, so we can lower the prio here.
The error handling can definitely be made better. I think it's great that we now display a stack trace error dialog. That was a huge improvement. But right, it can still be made better. Titanium just needs a try/catch block in the right places in our
onCreate()
methods to better catch exceptions and handle it more gracefully. Because since the app's UI is in a broken state, we're unable to show an error dialog. You have to look at the log instead. This is what you're seeing, right? The only error handling we can't handle gracefully are things that are loaded by the Android OS. Such as an activity or service in your AndroidManifest.xml that doesn't exist in Java. Things like that we're kind of screwed on, but it's no worse than it is for Android devs that go full native either.