Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Android crash: "Width and height must be > 0"

Hi!

My Android app keeps crashing on startup, and I can't make it work.
I have set all views' width and height to something static, but i still get this error.

Is there something else I can try?

Thanks!


[TRACE] E/TiUncaughtHandler( 746): (main) [405,405] Sending event: exception on thread: main msg:java.lang.IllegalArgumentException: width and height must be > 0; Titanium 1.7.0,2011/06/06 18:05,4155ee
[TRACE] E/TiUncaughtHandler( 746): java.lang.IllegalArgumentException: width and height must be > 0
[TRACE] E/TiUncaughtHandler( 746): at android.graphics.Bitmap.nativeCreate(Native Method)
[TRACE] E/TiUncaughtHandler( 746): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
[TRACE] E/TiUncaughtHandler( 746): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
[TRACE] E/TiUncaughtHandler( 746): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:412)
[TRACE] E/TiUncaughtHandler( 746): at ti.modules.titanium.ui.widget.TiUIImageView.setImage(TiUIImageView.java:589)
[TRACE] E/TiUncaughtHandler( 746): at ti.modules.titanium.ui.widget.TiUIImageView.processProperties(TiUIImageView.java:682)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:519)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:378)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:370)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.proxy.TiViewProxy.getView(TiViewProxy.java:356)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:384)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:370)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.proxy.TiViewProxy.getView(TiViewProxy.java:356)
[TRACE] E/TiUncaughtHandler( 746): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:384)
[TRACE] E/TiUncaughtHandler( 746): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:76)
[TRACE] E/TiUncaughtHandler( 746): at android.os.Handler.dispatchMessage(Handler.java:95)
[TRACE] E/TiUncaughtHandler( 746): at android.os.Looper.loop(Looper.java:123)
[TRACE] E/TiUncaughtHandler( 746): at android.app.ActivityThread.main(ActivityThread.java:4627)
[TRACE] E/TiUncaughtHandler( 746): at java.lang.reflect.Method.invokeNative(Native Method)
[TRACE] E/TiUncaughtHandler( 746): at java.lang.reflect.Method.invoke(Method.java:521)
[TRACE] E/TiUncaughtHandler( 746): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
[TRACE] E/TiUncaughtHandler( 746): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
[TRACE] E/TiUncaughtHandler( 746): at dalvik.system.NativeStart.main(Native Method)
[TRACE] E/AndroidRuntime( 746): FATAL EXCEPTION: main
[TRACE] E/AndroidRuntime( 746): java.lang.IllegalArgumentException: width and height must be > 0
[TRACE] E/AndroidRuntime( 746): at android.graphics.Bitmap.nativeCreate(Native Method)
[TRACE] E/AndroidRuntime( 746): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
[TRACE] E/AndroidRuntime( 746): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
[TRACE] E/AndroidRuntime( 746): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:412)
[TRACE] E/AndroidRuntime( 746): at ti.modules.titanium.ui.widget.TiUIImageView.setImage(TiUIImageView.java:589)
[TRACE] E/AndroidRuntime( 746): at ti.modules.titanium.ui.widget.TiUIImageView.processProperties(TiUIImageView.java:682)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:519)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:378)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:370)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.proxy.TiViewProxy.getView(TiViewProxy.java:356)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:384)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:370)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.proxy.TiViewProxy.getView(TiViewProxy.java:356)
[TRACE] E/AndroidRuntime( 746): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:384)
[TRACE] E/AndroidRuntime( 746): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:76)
[TRACE] E/AndroidRuntime( 746): at android.os.Handler.dispatchMessage(Handler.java:95)
[TRACE] E/AndroidRuntime( 746): at android.os.Looper.loop(Looper.java:123)
[TRACE] E/AndroidRuntime( 746): at android.app.ActivityThread.main(ActivityThread.java:4627)
[TRACE] E/AndroidRuntime( 746): at java.lang.reflect.Method.invokeNative(Native Method)
[TRACE] E/AndroidRuntime( 746): at java.lang.reflect.Method.invoke(Method.java:521)
[TRACE] E/AndroidRuntime( 746): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
[TRACE] E/AndroidRuntime( 746): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
[TRACE] E/AndroidRuntime( 746): at dalvik.system.NativeStart.main(Native Method)
— asked August 11th 2011 by Nils D
  • android
  • crash
  • height
  • width
4 Comments
  • Yes, you can post some code that can reproduce your issue. :)

    — commented August 11th 2011 by Ivan Škugor
  • I really can't post the code, I was hoping someone had an answer anyway =) None of my views has an width or height set to 'auto' or blank, and the app runs perfectly on iPhone.

    — commented August 11th 2011 by Nils D
  • Is there any way I can trace this error to a javascript line?

    — commented August 11th 2011 by Nils D
  • I don't know any easy way. :)

    — commented August 11th 2011 by Ivan Škugor

1 Answer

  • I tracked down this problem. I seems to be related to displayCaps somehow.

    — answered August 11th 2011 by Nils D
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.