updateLayout crashes android

You must Login before you can answer or comment on any questions.

Hi all,

I have created an app and on iPhone it works just fine, but on android it crashes without an error or mentioning in the debug or log. I removed in my API the updatelayout and it does not crash anymore on Android ( versions 2.3.3 , 4.0.3, 4.1) Can anyone explain? Using Titanium 2.1.2, 2.1.3 and 3.0.0.

Cheers, Carlo

— asked 7 months ago by Carlo Hermus
3 Comments
  • We are seeing the same issue. If I comment out all the calls to updateLayout, the crash goes away.

    [ERROR][TiApplication(  880)] (main) [57,57] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 2.1.3,2012/10/02 16:16,15997d0
    [ERROR][TiApplication(  880)] java.lang.NullPointerException
    [ERROR][TiApplication(  880)]   at org.appcelerator.titanium.proxy.TiViewProxy.handleFinishLayout(TiViewProxy.java:1029)
    [ERROR][TiApplication(  880)]   at org.appcelerator.titanium.proxy.TiViewProxy.handleUpdateLayout(TiViewProxy.java:1042)
    [ERROR][TiApplication(  880)]   at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:303)
    [ERROR][TiApplication(  880)]   at android.os.Handler.dispatchMessage(Handler.java:95)
    [ERROR][TiApplication(  880)]   at android.os.Looper.loop(Looper.java:137)
    [ERROR][TiApplication(  880)]   at android.app.ActivityThread.main(ActivityThread.java:4424)
    [ERROR][TiApplication(  880)]   at java.lang.reflect.Method.invokeNative(Native Method)
    [ERROR][TiApplication(  880)]   at java.lang.reflect.Method.invoke(Method.java:511)
    [ERROR][TiApplication(  880)]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    [ERROR][TiApplication(  880)]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    [ERROR][TiApplication(  880)]   at dalvik.system.NativeStart.main(Native Method)
    [ERROR][AndroidRuntime(  880)] FATAL EXCEPTION: main
    [ERROR][AndroidRuntime(  880)] java.lang.NullPointerException
    [ERROR][AndroidRuntime(  880)]  at org.appcelerator.titanium.proxy.TiViewProxy.handleFinishLayout(TiViewProxy.java:1029)
    [ERROR][AndroidRuntime(  880)]  at org.appcelerator.titanium.proxy.TiViewProxy.handleUpdateLayout(TiViewProxy.java:1042)
    [ERROR][AndroidRuntime(  880)]  at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:303)
    [ERROR][AndroidRuntime(  880)]  at android.os.Handler.dispatchMessage(Handler.java:95)
    [ERROR][AndroidRuntime(  880)]  at android.os.Looper.loop(Looper.java:137)
    [ERROR][AndroidRuntime(  880)]  at android.app.ActivityThread.main(ActivityThread.java:4424)
    [ERROR][AndroidRuntime(  880)]  at java.lang.reflect.Method.invokeNative(Native Method)
    [ERROR][AndroidRuntime(  880)]  at java.lang.reflect.Method.invoke(Method.java:511)
    [ERROR][AndroidRuntime(  880)]  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    [ERROR][AndroidRuntime(  880)]  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    [ERROR][AndroidRuntime(  880)]  at dalvik.system.NativeStart.main(Native Method)

    — commented 7 months ago by Kevin Coffman

  • The same thing happens with my app! Still searching for answers.

    — commented 7 months ago by Lachlan Ross

  • I haven't found any solutions for this. It works in my simple example app, but not in my "real" app. It seems to be a timing issue of some sort.

    Maybe for that reason, updateLayout() is deprecated in the CI build for 3.0.0. The CI build for 3.0.0 has a new function, applyProperties(), which seems to work on Android!

    — commented 7 months ago by Kevin Coffman

1 Answer

@Kevin,

I believe so indeed. Am using now SDK 3.0 with applyProperties and it works like a charm.

Your Answer

Think you can help? Login to answer this question!