java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jolicode.testview/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

Appcelerator JIRA | Xavier Lacot | 1 year ago
  1. 0

    When setting a view's layout to "null", the app completely crashes: {code} [ERROR] TiApplication: (main) [396,396] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jolicode.testview/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference; Titanium 5.0.2,2015/09/30 12:07,92c2265 [ERROR] TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jolicode.testview/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) [ERROR] TiApplication: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) [ERROR] TiApplication: at android.app.ActivityThread.access$800(ActivityThread.java:151) [ERROR] TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:135) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5254) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) [ERROR] TiApplication: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference [ERROR] TiApplication: at ti.modules.titanium.ui.widget.TiView.<init>(TiView.java:25) [ERROR] TiApplication: at ti.modules.titanium.ui.ViewProxy.createView(ViewProxy.java:33) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:485) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:509) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:493) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:672) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:566) [ERROR] TiApplication: at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:237) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:458) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:551) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18) [ERROR] TiApplication: at android.app.Activity.performCreate(Activity.java:5990) [ERROR] TiApplication: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) [ERROR] TiApplication: ... 10 more {code} Steps to reproduce: * create a new Alloy application * app/controllers/index.js : {code} $.index.open(); {code} * app/views/index.xml : {code} <Alloy> <Window> <View id="main" class="horizontal oh-shit"> <View id="firstChild"></View> </View> </Window> </Alloy> {code} * app/styles/index.tss : {code} '.horizontal': { layout: 'horizontal' } '.oh-shit': { layout: null } {code} * compile and run the app, it crashes at startup on android Reason: The [TiView class constructor|https://github.com/appcelerator/titanium_mobile/blob/bc85170157d3bebc5de1d61a9fe6e34bce84a8c9/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiView.java#L23] does not correctly check that the layout property is not null, and it crashes on line 25 when calling {{equals()}}. Expected behavior: The app should not crash and the view should have the default layout ({{LayoutArrangement.DEFAULT}})

    Appcelerator JIRA | 1 year ago | Xavier Lacot
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jolicode.testview/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
  2. 0

    When setting a view's layout to "null", the app completely crashes: {code} [ERROR] TiApplication: (main) [396,396] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jolicode.testview/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference; Titanium 5.0.2,2015/09/30 12:07,92c2265 [ERROR] TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jolicode.testview/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) [ERROR] TiApplication: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) [ERROR] TiApplication: at android.app.ActivityThread.access$800(ActivityThread.java:151) [ERROR] TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:135) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5254) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) [ERROR] TiApplication: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference [ERROR] TiApplication: at ti.modules.titanium.ui.widget.TiView.<init>(TiView.java:25) [ERROR] TiApplication: at ti.modules.titanium.ui.ViewProxy.createView(ViewProxy.java:33) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:485) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:509) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:493) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:672) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:566) [ERROR] TiApplication: at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:237) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:458) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:551) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18) [ERROR] TiApplication: at android.app.Activity.performCreate(Activity.java:5990) [ERROR] TiApplication: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) [ERROR] TiApplication: ... 10 more {code} Steps to reproduce: * create a new Alloy application * app/controllers/index.js : {code} $.index.open(); {code} * app/views/index.xml : {code} <Alloy> <Window> <View id="main" class="horizontal oh-shit"> <View id="firstChild"></View> </View> </Window> </Alloy> {code} * app/styles/index.tss : {code} '.horizontal': { layout: 'horizontal' } '.oh-shit': { layout: null } {code} * compile and run the app, it crashes at startup on android Reason: The [TiView class constructor|https://github.com/appcelerator/titanium_mobile/blob/bc85170157d3bebc5de1d61a9fe6e34bce84a8c9/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiView.java#L23] does not correctly check that the layout property is not null, and it crashes on line 25 when calling {{equals()}}. Expected behavior: The app should not crash and the view should have the default layout ({{LayoutArrangement.DEFAULT}})

    Appcelerator JIRA | 1 year ago | Xavier Lacot
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jolicode.testview/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
  3. 0

    NullPointerException

    GitHub | 2 years ago | petrnohejl
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.lang.NullPointerException

    GitHub | 1 year ago | techadroit
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
  6. 0

    boolean java.lang.String.equals(java.lang.Object)' on a null object reference error in ParseFacebookUtils.logInWithReadPermissionsBackground

    Stack Overflow | 2 years ago
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

    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.NullPointerException

      Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

      at ti.modules.titanium.ui.widget.TiView.<init>()
    2. ti.modules.titanium
      ViewProxy.createView
      1. ti.modules.titanium.ui.widget.TiView.<init>(TiView.java:25)
      2. ti.modules.titanium.ui.ViewProxy.createView(ViewProxy.java:33)
      2 frames
    3. org.appcelerator.titanium
      TiViewProxy.add
      1. org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:485)
      2. org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471)
      3. org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:509)
      4. org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:493)
      5. org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:471)
      6. org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:672)
      7. org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:566)
      7 frames
    4. ti.modules.titanium
      WindowProxy.windowCreated
      1. ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:237)
      1 frame
    5. org.appcelerator.titanium
      TiActivity.onCreate
      1. org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33)
      2. org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:458)
      3. org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:551)
      4. org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
      4 frames
    6. Android Platform
      ActivityThread.main
      1. android.app.Activity.performCreate(Activity.java:5990)
      2. android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
      3. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
      4. android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
      5. android.app.ActivityThread.access$800(ActivityThread.java:151)
      6. android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
      7. android.os.Handler.dispatchMessage(Handler.java:102)
      8. android.os.Looper.loop(Looper.java:135)
      9. android.app.ActivityThread.main(ActivityThread.java:5254)
      9 frames
    7. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    8. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
      2 frames