java.lang.IndexOutOfBoundsException

tip

Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range. Applications can subclass this class to indicate similar exceptions.


rafaelrafael

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Reproduction steps: 1. Create a new titanium app 2. Put the following entry inside your tiapp.xml {code} <property name="ti.android.bug2373.disableDetection" type="bool">true</property> {code} 3. Create an apk for the app via the distribute command 4. Push the app to the phone via 'adb push myApp /mnt/sdcard/' 5. Use some file explorer on your phone like Astro (you may need to download this) and install the app 6. After the app has been installed, click 'open' 7. Push home 8. Open the same app again from the app list 9. Repeat 7-8 a few times 10. When you have the app open, hit back Expected Result: The app should back out without crashing Actual Result: The app crashes with the error message: {code} E/AndroidRuntime(19143): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 E/AndroidRuntime(19143): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) E/AndroidRuntime(19143): at java.util.ArrayList.get(ArrayList.java:304) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:201) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:205) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164) E/AndroidRuntime(19143): at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:167) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiBaseActivity.onBackPressed(TiBaseActivity.java:609) E/AndroidRuntime(19143): at android.app.Activity.onKeyUp(Activity.java:2099) E/AndroidRuntime(19143): at android.view.KeyEvent.dispatch(KeyEvent.java:2575) E/AndroidRuntime(19143): at android.app.Activity.dispatchKeyEvent(Activity.java:2329) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiBaseActivity.dispatchKeyEvent(TiBaseActivity.java:740) E/AndroidRuntime(19143): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1806) E/AndroidRuntime(19143): at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3327) E/AndroidRuntime(19143): at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3300) E/AndroidRuntime(19143): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2460) E/AndroidRuntime(19143): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(19143): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(19143): at android.app.ActivityThread.main(ActivityThread.java:4424) E/AndroidRuntime(19143): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(19143): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(19143): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) E/AndroidRuntime(19143): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) E/AndroidRuntime(19143): at dalvik.system.NativeStart.main(Native Method) {code} NOTE: This seems to happen consistently on 4.0.4 devices. This behavior varies on other versions.
    via by Allen Yeung,
  • Reproduction steps: 1. Create a new titanium app 2. Put the following entry inside your tiapp.xml {code} <property name="ti.android.bug2373.disableDetection" type="bool">true</property> {code} 3. Create an apk for the app via the distribute command 4. Push the app to the phone via 'adb push myApp /mnt/sdcard/' 5. Use some file explorer on your phone like Astro (you may need to download this) and install the app 6. After the app has been installed, click 'open' 7. Push home 8. Open the same app again from the app list 9. Repeat 7-8 a few times 10. When you have the app open, hit back Expected Result: The app should back out without crashing Actual Result: The app crashes with the error message: {code} E/AndroidRuntime(19143): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 E/AndroidRuntime(19143): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) E/AndroidRuntime(19143): at java.util.ArrayList.get(ArrayList.java:304) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:201) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:205) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164) E/AndroidRuntime(19143): at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:167) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiBaseActivity.onBackPressed(TiBaseActivity.java:609) E/AndroidRuntime(19143): at android.app.Activity.onKeyUp(Activity.java:2099) E/AndroidRuntime(19143): at android.view.KeyEvent.dispatch(KeyEvent.java:2575) E/AndroidRuntime(19143): at android.app.Activity.dispatchKeyEvent(Activity.java:2329) E/AndroidRuntime(19143): at org.appcelerator.titanium.TiBaseActivity.dispatchKeyEvent(TiBaseActivity.java:740) E/AndroidRuntime(19143): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1806) E/AndroidRuntime(19143): at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3327) E/AndroidRuntime(19143): at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3300) E/AndroidRuntime(19143): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2460) E/AndroidRuntime(19143): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(19143): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(19143): at android.app.ActivityThread.main(ActivityThread.java:4424) E/AndroidRuntime(19143): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(19143): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(19143): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) E/AndroidRuntime(19143): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) E/AndroidRuntime(19143): at dalvik.system.NativeStart.main(Native Method) {code} NOTE: This seems to happen consistently on 4.0.4 devices. This behavior varies on other versions.
    via by Allen Yeung,
  • IndexOutOfBoundsException
    via GitHub by mattjohnpowell
    ,
  • High: Getting an odd crash
    via GitHub by Ckozoh
    ,
  • Crash when logging
    via GitHub by koem
    ,
    • java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) at java.util.ArrayList.get(ArrayList.java:304) at org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:201) at org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164) at org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:205) at org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164) at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:167) at org.appcelerator.titanium.TiBaseActivity.onBackPressed(TiBaseActivity.java:609) at android.app.Activity.onKeyUp(Activity.java:2099) at android.view.KeyEvent.dispatch(KeyEvent.java:2575) at android.app.Activity.dispatchKeyEvent(Activity.java:2329) at org.appcelerator.titanium.TiBaseActivity.dispatchKeyEvent(TiBaseActivity.java:740) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1806) at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3327) at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3300) at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2460) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) 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:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method)

    Users with the same issue

    MacaponMacapon
    6 times, last one,
    szosziszoszi
    2 times, last one,
    LartenLarten
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    winer222winer222
    3 times, last one,
    237 more bugmates