[AC-1178] Android: App crashes and doesn't starts up normally after been terminated by the device
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2014-09-03T18:28:38.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | TCSupportTriage, android, appcompat, crashes, defect, sdk3.3, triageSupport |
Reporter | Lee phela |
Assignee | Radamantis Torres-Lechuga |
Created | 2014-08-05T11:41:47.000+0000 |
Updated | 2016-03-08T07:37:33.000+0000 |
Description
It looks like this behavior appears only in the 3.3.0 version of the titanium SDK.
When the app running in the background, auto killed by the device to free up memory for other apps, is brought back to the foreground, the app hang up and freezes for 2-6 seconds(depending on the device specs and performances, the better the device, the shorter the freeze), pops-up an alert dialog box "Unfortunately, APP_NAME has stopped", crashes, and then it only starts up.
HOW TO REPRODUCE :-
Run the kitchen sink project/any hello world program (appcompat theme) and put the app to the background .
Open up a browser and navigates to some huge websites loaded with big images and such, so as to make the system force kill our titanium app.
When it has been finally killed, try to bring back the same app to the foreground.
EXPECTED BEHAVIOR -
The app should starts up again normally and there should not be a freeze/alert dialog box popping up/crash.
Here is the crash report
[code]
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.id/org.appcelerator.titanium.TiActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTab$TabFragment: make sure class name exists, is public, and has an empty constructor that is public
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTab$TabFragment: make sure class name exists, is public, and has an empty constructor that is public
at android.support.v4.app.Fragment.instantiate(Fragment.java:413)
at android.support.v4.app.FragmentState.instantiate(Fragment.java:97)
at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1801)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:213)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:97)
at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:473)
at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
... 11 more
Caused by: java.lang.InstantiationException: can't instantiate class ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTab$TabFragment; no empty constructor
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.support.v4.app.Fragment.instantiate(Fragment.java:402)
... 20 more
[/code]
can't reproduce.
Hello Shuo Liang, I dont know why you are closing the issues as irreproducible. In case if you missed anything, here is the exact steps that you need to follow to reproduce it - 1. Create a classic (not alloy) default titanium mobile app project (Tabbed app) or if you have trouble with it, here's the app.js file that you can straightway copy-paste
2. Modify the android tag in your manifest files to something like this
3. Now install the created app to a real device and run it. 4. Put the titanium app to background. 5. Opens up and run as many applications from the phone or go to a really big website and starts browsing and try to force kill our titanium app . 6. When the titanium app is finally killed by the device, try to bring back the titanium app from the background. THE APP FREEZES with just nothing but an empty TABGROUP and hangs forever!
Hey I encountered the same crash report, after submitting my app to Play Store with SDK 3.3.0. Here is my report. Basically the same: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.id/org.appcelerator.titanium.TiActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTab$TabFragment: make sure class name exists, is public, and has an empty constructor that is public at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146) at android.app.ActivityThread.access$700(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4947) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStart.main(Native Method) Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTab$TabFragment: make sure class name exists, is public, and has an empty constructor that is public at android.support.v4.app.Fragment.instantiate(Fragment.java:413) at android.support.v4.app.FragmentState.instantiate(Fragment.java:97) at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1801) at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:213) at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:97) at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:473) at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18) at android.app.Activity.performCreate(Activity.java:5207) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2085) ... 11 more Caused by: java.lang.InstantiationException: can't instantiate class ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTab$TabFragment; no empty constructor at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1319) at android.support.v4.app.Fragment.instantiate(Fragment.java:402) ... 20 more
[~mpmiranda], Any idea about this situation? we can't reproduce, but customers keeps saying the problem existing.
Our is kind of popular in the playstore and we are receiving more than 70-90 crashes and ANR report per day. And we have to continuously keep reminding the users to not background the app during the session of usage , which overall create a horrible bad user experience! The crash is producible only in a real device and not on emulator as it seems like emulator never terminates a backgrounded app due to memory exhaustion! Confirmed and tested on nexus 5 and samsung phones!
I didn't get such crash report before SDK 3.3.0. That's the thing. What do you mean "not to background the app during the session of usage?" Is that something I can control as an developer? Thanks!
I don't think you can control over that! If your app is in the background, the device can kills it anytime when it starts to run low on memory. If the App is normally exited via back button, no such crash is produced! But however if the app is auto killed first by the device, then the app will first splash a white screen, crash it, prompts up an alert dialog box about the crash, and will only starts up again! I'm not sure which causes the crAsh - sdk 3.3.0 or studio 3.3.0 or cli 3.3.0 but one thing that I'm so sure of it is - THIS CRASH STARTS TO APPEARS ONLY AFTER I UPGRADE TO ALL THESE THREE!
I've placed this into triage.
[~hpham] to mark as a duplicate of a related issue.