App crashing on build but not on Preview

The strangest thing happens: My app works flawlessly in an Android device when using the Preview, but when I build my app and make a certain action in the app, it crashes.

Here’s the log:

Installing APK on 1 device(s)

Launching activity 'voyagercheckin'

Running logcat on 'G000KU06650306DP'
I/art     ( 4526): Late-enabling -Xcheck:jni
I/ActivityManager(  520): Start proc 4526:com.apps.voyagercheckin/u0a20 for activity com.apps.voyagercheckin/.voyagercheckin
D/ActivityManager( 4526): default service binder = android.os.BinderProxy@279d3487
D/ActivityManager( 4526): default service = android.app.ActivityManagerProxy@2b5aafb4
D/VendorDisplayManagerGlobalCallback( 4526): callGetInstance: nil
I/ContextImpl( 4526): com.amazon.client.metrics.api registered service at i = 70
D/ProfileManager( 4526): Create ProfileManager instance
D/voyagercheckin( 4526): SDK: 22
W/linker  ( 4526): libgnustl_shared.so: unused DT entry: type 0x6ffffffe arg 0x47d58
W/linker  ( 4526): libgnustl_shared.so: unused DT entry: type 0x6fffffff arg 0x2
W/linker  ( 4526): libV8Simple.so: unused DT entry: type 0x6ffffffe arg 0x2e070
W/linker  ( 4526): libV8Simple.so: unused DT entry: type 0x6fffffff arg 0x3
W/linker  ( 4526): libvoyagercheckin.so: unused DT entry: type 0x6ffffffe arg 0x22deac
W/linker  ( 4526): libvoyagercheckin.so: unused DT entry: type 0x6fffffff arg 0x2
I/FrameworkJumpTable( 4526): Successfully loaded all classes
I/FrameworkJumpTable( 4526): Successfully loaded all methods
I/FrameworkJumpTable( 4526): Successfully loaded all fields
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0xf7c7ff60 handle=0xeb9b1544
D/mali_winsys( 4526): new_window_surface returns 0x3000

D/OpenGLRenderer( 4526): Use EGL_SWAP_BEHAVIOR_PRESERVED: false
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x12e8a740 handle=0xeb9b1544
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/[MALI][Gralloc]( 4526): [+]r_hnd:0xf8088cd0, fd:32, ion_hnd(0x1), req_format(0x1), int_fmt(0x1)  byte_stride(3328), flags(0x4), usage(0x100), size(3833856), alloc_size(3833856) 832(832)X1152(1152) pid(4526)  sec (0)
D/Atlas   ( 4526): Validating map...

I/OpenGLRenderer( 4526): Initialized EGL, version 1.4
D/OpenGLRenderer( 4526): Enabling debug mode 0
D/mali_winsys( 4526): new_window_surface returns 0x3000

D/mali_winsys( 4526): new_window_surface returns 0x3000
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/[MALI][Gralloc]( 4526): [+]r_hnd:0xf82aab08, fd:39, ion_hnd(0x2), req_format(0x1), int_fmt(0x1)  byte_stride(3200), flags(0x4), usage(0xb00), size(4096000), alloc_size(4096000) 800(800)X1280(1280) pid(4526)  sec (0)
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544

I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/[MALI][Gralloc]( 4526): [+]r_hnd:0xf82fb440, fd:41, ion_hnd(0x3), req_format(0x1), int_fmt(0x1)  byte_stride(3200), flags(0x4), usage(0xb00), size(4096000), alloc_size(4096000) 800(800)X1280(1280) pid(4526)  sec (0)
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/[MALI][Gralloc]( 4526): [+]r_hnd:0xf839f930, fd:43, ion_hnd(0x4), req_format(0x1), int_fmt(0x1)  byte_stride(3200), flags(0x4), usage(0xb00), size(4096000), alloc_size(4096000) 800(800)X1280(1280) pid(4526)  sec (0)
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/[MALI][Gralloc]( 4526): [+]r_hnd:0xf8294b60, fd:42, ion_hnd(0x5), req_format(0x1), int_fmt(0x1)  byte_stride(3200), flags(0x4), usage(0xb00), size(4096000), alloc_size(4096000) 800(800)X1280(1280) pid(4526)  sec (0)
I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/[MALI][Gralloc]( 4526): [+]r_hnd:0xf8297448, fd:44, ion_hnd(0x6), req_format(0x1), int_fmt(0x1)  byte_stride(3200), flags(0x4), usage(0xb00), size(4096000), alloc_size(4096000) 800(800)X1280(1280) pid(4526)  sec (0)

I/HAL     ( 4526): loaded HAL id=gralloc path=/system/lib/hw/gralloc.mt8163.mali.so hmi=0x0 handle=0xeb9b1544
I/[MALI][Gralloc]( 4526): [+]r_hnd:0xf8294440, fd:45, ion_hnd(0x7), req_format(0x1), int_fmt(0x1)  byte_stride(3200), flags(0x4), usage(0xb00), size(4096000), alloc_size(4096000) 800(800)X1280(1280) pid(4526)  sec (0)

W/ResourceType( 4526): Attempt to retrieve bag 0x0103003e which is invalid or in a cycle.

D/CRLSetManager( 4526): getInstance binder: android.os.BinderProxy@6736861

D/voyager-checkin( 4526): Entro: Ghost%20Contact

D/CRLSetManager( 4526): getInstance binder: android.os.BinderProxy@6736861

D/voyager-checkin( 4526): Entro: Ghost%20Contact

E/voyager-checkin( 4526): Uno.NullReferenceException: Object reference was null
D/voyagercheckin( 4526): Uno.NullReferenceException: Object reference was null
D/AndroidRuntime( 4526): Shutting down VM
E/AndroidRuntime( 4526): FATAL EXCEPTION: main
E/AndroidRuntime( 4526): Process: com.apps.voyagercheckin, PID: 4526
E/AndroidRuntime( 4526): java.lang.RuntimeException: Uno.NullReferenceException: Object reference was null
E/AndroidRuntime( 4526):        at com.Bindings.ExternedBlockHost.callUno_Uno_Platform_AndroidDisplay_OnFrameCallback55(Native Method)
E/AndroidRuntime( 4526):        at com.foreign.Uno.Platform.AndroidDisplay$1.doFrame(AndroidDisplay.java:55)
E/AndroidRuntime( 4526):        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:779)
E/AndroidRuntime( 4526):        at android.view.Choreographer.doCallbacks(Choreographer.java:592)
E/AndroidRuntime( 4526):        at android.view.Choreographer.doFrame(Choreographer.java:559)
E/AndroidRuntime( 4526):        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:767)
E/AndroidRuntime( 4526):        at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime( 4526):        at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 4526):        at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 4526):        at android.app.ActivityThread.main(ActivityThread.java:5484)
E/AndroidRuntime( 4526):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4526):        at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 4526):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
E/AndroidRuntime( 4526):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
I/AndroidRuntime( 4526): To Report FATAL to activityManagerService

I/AndroidRuntime( 4526): Finished reporting FATAL to activityManagerService
I/Process ( 4526): Sending signal. PID: 4526 SIG: 9

I/Kernel  ( 4526): [350849.666556] <1> (1)[4670:AsyncTask #2][name:ion&][ION]warning: release handle @ client destroy: handle=ffffffc053f90200, buf=ffffffc002398300, ref=4, size=4096000, kmap=0
I/Kernel  ( 4526): [350849.666585] <1> (1)[4670:AsyncTask #2][name:ion&][ION]warning: release handle @ client destroy: handle=ffffffc0528ea880, buf=ffffffc002398400, ref=2, size=4096000, kmap=0
I/Kernel  ( 4526): [350849.666601] <1> (1)[4670:AsyncTask #2][name:ion&][ION]warning: release handle @ client destroy: handle=ffffffc051fb0680, buf=ffffffc00d23c500, ref=2, size=4096000, kmap=0
I/Kernel  ( 4526): [350849.666616] <1> (1)[4670:AsyncTask #2][name:ion&][ION]warning: release handle @ client destroy: handle=ffffffc059214200, buf=ffffffc00d252e00, ref=2, size=4096000, kmap=0
I/Kernel  ( 4526): [350849.666631] <1> (1)[4670:AsyncTask #2][name:ion&][ION]warning: release handle @ client destroy: handle=ffffffc00d4fe280, buf=ffffffc025a37d00, ref=4, size=4096000, kmap=0
I/Kernel  ( 4526): [350849.666646] <1> (1)[4670:AsyncTask #2][name:ion&][ION]warning: release handle @ client destroy: handle=ffffffc007de1c80, buf=ffffffc026656400, ref=2, size=4096000, kmap=0
I/Kernel  ( 4526): [350849.666662] <1> (1)[4670:AsyncTask #2][name:ion&][ION]warning: release handle @ client destroy: handle=ffffffc01cda7b00, buf=ffffffc051762900, ref=6, size=3833856, kmap=0
I/ActivityManager(  520): Process com.apps.voyagercheckin (pid 4526) has died
D/ActivityManager(  520): cleanUpApplicationRecord -- 4526
W/Eve     (  520): MEMORY_CRITICAL: Memory available=597508KB free=136236KB LMK kills [4526,1]

Process com.apps.voyagercheckin terminated.

Anyone with a clue on what could be happening? Thanks!

Hello

The stack trace alone doesn’t really give any hints on what happened unless we have code to look at. Are you able to provide a minimal app reproducing the exception above, for debugging?

Thanks!

As we found, this was caused by a data-binding being lost when used inside of a UX expression.

Expecting @Juani to come back with a reproduction shortly, and we’ll log a ticket about that.

Ok, this is the bug reproduction. I commented the line that is crashing the app.

<App Background="Black">
  <JavaScript>
    var Observable = require("FuseJS/Observable");
    var dynamicText = Observable('');

    function changeText() {
      dynamicText.value = "John Doe";
    }

    module.exports = {
      dynamicText: dynamicText,
      changeText: changeText
    }
  </JavaScript>
    <StackPanel Alignment="VerticalCenter" ItemSpacing="20">
      <Rectangle Alignment="Center" Padding="10" Color="Red">
        <Text Color="#fff" Value="Change Text" />
        <Clicked>
            <Callback Handler="{changeText}"/>
        </Clicked>
      </Rectangle>
      <myTextPanel textName="{dynamicText}" />
    </StackPanel>

    <Panel ux:Class="myTextPanel">
      <string ux:Property="textName" />
      <!--
        This crashes on build but it doesn't crashes on Preview:

        <Text Value="HI {= toUpper({ReadProperty textName})}!" TextAlignment="Center" Alignment="VerticalCenter" />
      -->
      <!--
        This doesn't crashes on build or Preview:
      -->
      <Text Value="HI {ReadProperty textName}!" TextAlignment="Center" Alignment="VerticalCenter" />
    </Panel>
</App>

Thanks for an excellent reproduction! I’ve now logged an internal ticket about this and someone will take a look at it shortly.

We’ll notify here when there’s some progress.

This one was fixed a while back.