Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-4889

Android: View.backgroundImage With 24-bit PNG Crashes App with 1.7.2

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Duplicate
    • Affects Version/s: Release 1.7.2, Release 2.0.2
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Tested with the official 1.7.2 release
      WORKS in Android Emulator 2.2
      BROKEN on Android Device Epic 4G 2.2
      BROKEN on Android Device Fascinate 2.2
      BROKEN on Android Device Droid X 2.2

      Description

      Problem

      Using a 24-bit PNG as the backgroundImage of a view causes the app to crash on 1.7.2 on device.

      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.

      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();
      

      Error Log

      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)
      

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              dtoth Dawson Toth
            • Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code