java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

Appcelerator JIRA | Allen Yeung | 4 years ago
  1. 0

    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.

    Appcelerator JIRA | 4 years ago | Allen Yeung
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  2. 0

    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.

    Appcelerator JIRA | 4 years ago | Allen Yeung
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  3. 0

    High: Getting an odd crash

    GitHub | 2 years ago | Ckozoh
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Crash when tapping the dropdown action bar when tag list is still empty

    GitHub | 2 years ago | maxme
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  6. 0

    IndexOutOfBoundsException Crashing

    GitHub | 3 years ago | bdonahue
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IndexOutOfBoundsException

    Invalid index 0, size is 0

    at java.util.ArrayList.throwIndexOutOfBoundsException()
  2. Java RT
    ArrayList.get
    1. java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
    2. java.util.ArrayList.get(ArrayList.java:304)
    2 frames
  3. org.appcelerator.titanium
    TiRootActivity.finish
    1. org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:201)
    2. org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164)
    3. org.appcelerator.titanium.TiApplication.terminateActivityStack(TiApplication.java:205)
    4. org.appcelerator.titanium.TiRootActivity.finish(TiRootActivity.java:164)
    4 frames
  4. Android Support v4
    FragmentActivity.onBackPressed
    1. android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:167)
    1 frame
  5. org.appcelerator.titanium
    TiBaseActivity.onBackPressed
    1. org.appcelerator.titanium.TiBaseActivity.onBackPressed(TiBaseActivity.java:609)
    1 frame
  6. Android Platform
    Activity.dispatchKeyEvent
    1. android.app.Activity.onKeyUp(Activity.java:2099)
    2. android.view.KeyEvent.dispatch(KeyEvent.java:2575)
    3. android.app.Activity.dispatchKeyEvent(Activity.java:2329)
    3 frames
  7. org.appcelerator.titanium
    TiBaseActivity.dispatchKeyEvent
    1. org.appcelerator.titanium.TiBaseActivity.dispatchKeyEvent(TiBaseActivity.java:740)
    1 frame
  8. Android
    PhoneWindow$DecorView.dispatchKeyEvent
    1. com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1806)
    1 frame
  9. Android Platform
    ActivityThread.main
    1. android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3327)
    2. android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3300)
    3. android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2460)
    4. android.os.Handler.dispatchMessage(Handler.java:99)
    5. android.os.Looper.loop(Looper.java:137)
    6. android.app.ActivityThread.main(ActivityThread.java:4424)
    6 frames
  10. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:511)
    2 frames
  11. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    2 frames
  12. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame