java.lang.RuntimeException: Unable to start activity ComponentInfo{com.navtrak.navtrakmobile/com.navtrak.navtrakmobile.NavtrakActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

Appcelerator JIRA | Dawson Toth | 6 years ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0

    h1. Problem Using a 24-bit PNG as the backgroundImage of a view causes the app to crash on 1.7.2 on device. h2. Reproduction 1. Download the following image to your resources directory: http://tothsolutions.com/logostrip.png (note: if you specify the remote image, the app will NOT crash. But if you save it locally and use that image, it will crash.) 2. Drop the following in an app.js, and run it using 1.7.2. The app will crash. {code:title=app.js} var win = Ti.UI.createWindow(); win.add(Ti.UI.createView({ top: 0, left: 0, right: 0, height: 33, backgroundImage: 'logostrip.png' })); win.open(); {code} h2. Error Log {code:title=Error Log} 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): (main) [218,608] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.navtrak.navtrakmobile/com.navtrak.navtrakmobile.NavtrakActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0; Titanium 1.7.2,2011/07/21 09:36,97c3689 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.navtrak.navtrakmobile/com.navtrak.navtrakmobile.NavtrakActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2757) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2775) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.access$2500(ActivityThread.java:130) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.os.Handler.dispatchMessage(Handler.java:99) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.os.Looper.loop(Looper.java:143) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.main(ActivityThread.java:4773) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.lang.reflect.Method.invokeNative(Native Method) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.lang.reflect.Method.invoke(Method.java:521) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at dalvik.system.NativeStart.main(Native Method) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.util.ArrayList.get(ArrayList.java:311) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiNinePatchHelper.createChunk(TiNinePatchHelper.java:187) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiNinePatchHelper.process(TiNinePatchHelper.java:50) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiFileHelper.loadDrawable(TiFileHelper.java:320) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiFileHelper.loadDrawable(TiFileHelper.java:260) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiUIHelper.buildBackgroundDrawable(TiUIHelper.java:447) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.view.TiUIView.handleBackgroundImage(TiUIView.java:655) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:453) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:38) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:519) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:378) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:370) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.getView(TiViewProxy.java:356) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:434) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:196) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:100) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:86) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.os.Handler.dispatchMessage(Handler.java:95) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.TiMessageQueue.dispatchMessage(TiMessageQueue.java:320) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.TiMessageQueue.dispatchPendingMessages(TiMessageQueue.java:304) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.TiMessageQueue$2.getResult(TiMessageQueue.java:172) {code}

    Appcelerator JIRA | 6 years ago | Dawson Toth
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.navtrak.navtrakmobile/com.navtrak.navtrakmobile.NavtrakActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  2. 0

    h1. Problem Using a 24-bit PNG as the backgroundImage of a view causes the app to crash on 1.7.2 on device. h2. Reproduction 1. Download the following image to your resources directory: http://tothsolutions.com/logostrip.png (note: if you specify the remote image, the app will NOT crash. But if you save it locally and use that image, it will crash.) 2. Drop the following in an app.js, and run it using 1.7.2. The app will crash. {code:title=app.js} var win = Ti.UI.createWindow(); win.add(Ti.UI.createView({ top: 0, left: 0, right: 0, height: 33, backgroundImage: 'logostrip.png' })); win.open(); {code} h2. Error Log {code:title=Error Log} 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): (main) [218,608] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.navtrak.navtrakmobile/com.navtrak.navtrakmobile.NavtrakActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0; Titanium 1.7.2,2011/07/21 09:36,97c3689 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.navtrak.navtrakmobile/com.navtrak.navtrakmobile.NavtrakActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2757) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2775) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.access$2500(ActivityThread.java:130) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.os.Handler.dispatchMessage(Handler.java:99) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.os.Looper.loop(Looper.java:143) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.app.ActivityThread.main(ActivityThread.java:4773) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.lang.reflect.Method.invokeNative(Native Method) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.lang.reflect.Method.invoke(Method.java:521) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at dalvik.system.NativeStart.main(Native Method) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at java.util.ArrayList.get(ArrayList.java:311) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiNinePatchHelper.createChunk(TiNinePatchHelper.java:187) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiNinePatchHelper.process(TiNinePatchHelper.java:50) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiFileHelper.loadDrawable(TiFileHelper.java:320) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiFileHelper.loadDrawable(TiFileHelper.java:260) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.util.TiUIHelper.buildBackgroundDrawable(TiUIHelper.java:447) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.view.TiUIView.handleBackgroundImage(TiUIView.java:655) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:453) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:38) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:519) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:378) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:370) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.getView(TiViewProxy.java:356) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:434) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:196) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:100) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:86) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at android.os.Handler.dispatchMessage(Handler.java:95) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.TiMessageQueue.dispatchMessage(TiMessageQueue.java:320) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.TiMessageQueue.dispatchPendingMessages(TiMessageQueue.java:304) 08-04 11:33:29.649: ERROR/TiUncaughtHandler(11597): at org.appcelerator.titanium.TiMessageQueue$2.getResult(TiMessageQueue.java:172) {code}

    Appcelerator JIRA | 6 years ago | Dawson Toth
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.navtrak.navtrakmobile/com.navtrak.navtrakmobile.NavtrakActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  3. 0
    samebug 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.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    StartApp Ad not showing on my App

    Stack Overflow | 4 years ago | nmvictor
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  6. 0

    Android AsyncTask only loaded one item into ArrayAdapter?

    Stack Overflow | 6 years ago | yoshi24
    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:257)
    2. java.util.ArrayList.get(ArrayList.java:311)
    2 frames
  3. org.appcelerator.titanium
    TiUIView.processProperties
    1. org.appcelerator.titanium.util.TiNinePatchHelper.createChunk(TiNinePatchHelper.java:187)
    2. org.appcelerator.titanium.util.TiNinePatchHelper.process(TiNinePatchHelper.java:50)
    3. org.appcelerator.titanium.util.TiFileHelper.loadDrawable(TiFileHelper.java:320)
    4. org.appcelerator.titanium.util.TiFileHelper.loadDrawable(TiFileHelper.java:260)
    5. org.appcelerator.titanium.util.TiUIHelper.buildBackgroundDrawable(TiUIHelper.java:447)
    6. org.appcelerator.titanium.view.TiUIView.handleBackgroundImage(TiUIView.java:655)
    7. org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:453)
    7 frames
  4. ti.modules.titanium
    TiView.processProperties
    1. ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:38)
    1 frame
  5. org.appcelerator.kroll
    KrollProxy.setModelListener
    1. org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:519)
    1 frame
  6. org.appcelerator.titanium
    TiWindowProxy.handleMessage
    1. org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:378)
    2. org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:370)
    3. org.appcelerator.titanium.proxy.TiViewProxy.getView(TiViewProxy.java:356)
    4. org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:434)
    5. org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:196)
    6. org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:100)
    6 frames
  7. ti.modules.titanium
    WindowProxy.handleMessage
    1. ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:86)
    1 frame
  8. Android Platform
    Handler.dispatchMessage
    1. android.os.Handler.dispatchMessage(Handler.java:95)
    1 frame
  9. org.appcelerator.titanium
    TiMessageQueue$2.getResult
    1. org.appcelerator.titanium.TiMessageQueue.dispatchMessage(TiMessageQueue.java:320)
    2. org.appcelerator.titanium.TiMessageQueue.dispatchPendingMessages(TiMessageQueue.java:304)
    3. org.appcelerator.titanium.TiMessageQueue$2.getResult(TiMessageQueue.java:172)
    3 frames