java.lang.NullPointerException

Appcelerator JIRA | Philippe Wueger | 3 years ago
  1. 0

    h4. Problem Google Play Crash reports contain multiple of the following NullPointerExceptions occuring at the same place: {code} java.lang.NullPointerException at android.view.ViewConfiguration.get(ViewConfiguration.java:228) at android.view.View.<init>(View.java:1888) at android.view.ViewGroup.<init>(ViewGroup.java:281) at android.widget.FrameLayout.<init>(FrameLayout.java:80) at ti.modules.titanium.ui.widget.tableview.TiTableView.<init>(TiTableView.java:266) at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:106) at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1129) at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469) at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) at ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:146) at ti.modules.titanium.ui.TableViewProxy.handleSetData(TableViewProxy.java:689) at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:866) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3691) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) at dalvik.system.NativeStart.main(Native Method) {code} {code} Caused by: java.lang.NullPointerException at android.view.ViewConfiguration.get(ViewConfiguration.java:230) at android.view.View.<init>(View.java:1920) at android.view.ViewGroup.<init>(ViewGroup.java:303) at android.widget.FrameLayout.<init>(FrameLayout.java:80) at ti.modules.titanium.ui.widget.tableview.TiTableView.<init>(TiTableView.java:266) at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:106) at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1129) at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469) at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) at ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:146) at ti.modules.titanium.ui.TableViewProxy.handleSetData(TableViewProxy.java:689) at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:866) at android.os.Handler.dispatchMessage(Handler.java:95) at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:364) at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:349) at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:234) at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:261) at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:186) at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:740) at org.appcelerator.titanium.TiBaseActivity.onStop(TiBaseActivity.java:1058) at org.appcelerator.titanium.TiLaunchActivity.onStop(TiLaunchActivity.java:355) at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1272) at android.app.Activity.performStop(Activity.java:4073) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3127) ... 11 more {code} {code} Caused by: java.lang.NullPointerException at android.view.ViewConfiguration.get(ViewConfiguration.java:228) at android.view.View.<init>(View.java:1878) at android.view.ViewGroup.<init>(ViewGroup.java:281) at android.widget.FrameLayout.<init>(FrameLayout.java:80) at ti.modules.titanium.ui.widget.tableview.TiTableView.<init>(TiTableView.java:266) at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:106) at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1129) at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469) at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) at ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:146) at ti.modules.titanium.ui.TableViewProxy.handleSetData(TableViewProxy.java:689) at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:866) at android.os.Handler.dispatchMessage(Handler.java:95) at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:364) at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:349) at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:234) at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:261) at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:186) at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:740) at org.appcelerator.titanium.TiBaseActivity.onPause(TiBaseActivity.java:917) at org.appcelerator.titanium.TiLaunchActivity.onPause(TiLaunchActivity.java:339) at android.app.Activity.performPause(Activity.java:3851) at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191) at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2345) ... 12 more {code} h4. Test Case Unfortunately, I haven't been able to find steps to reproduce this issue. The best way to go forward in my opinion is to analyze the code and to try and figure out from there, what is going wrong. h4. My Analysis From the code I see, that in the TiTableViewConstructor a call to "super(proxy.getActivity())" is done. In "proxy.getActivity()" it is noted, that this may return "null". I assume that this would lead to the crash reports above. Could it be that we have a possible race condition or something similar here, where "proxy.getActivity()" is called, before the proxy actually has an activity assigned to it? Is anyone else seeing this problem on a large installation base? It would be great to improve the stability of Titanium further by fixing this issue.

    Appcelerator JIRA | 3 years ago | Philippe Wueger
    java.lang.NullPointerException
  2. 0

    h4. Problem Google Play Crash reports contain multiple of the following NullPointerExceptions occuring at the same place: {code} java.lang.NullPointerException at android.view.ViewConfiguration.get(ViewConfiguration.java:228) at android.view.View.<init>(View.java:1888) at android.view.ViewGroup.<init>(ViewGroup.java:281) at android.widget.FrameLayout.<init>(FrameLayout.java:80) at ti.modules.titanium.ui.widget.tableview.TiTableView.<init>(TiTableView.java:266) at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:106) at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1129) at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469) at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) at ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:146) at ti.modules.titanium.ui.TableViewProxy.handleSetData(TableViewProxy.java:689) at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:866) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3691) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) at dalvik.system.NativeStart.main(Native Method) {code} {code} Caused by: java.lang.NullPointerException at android.view.ViewConfiguration.get(ViewConfiguration.java:230) at android.view.View.<init>(View.java:1920) at android.view.ViewGroup.<init>(ViewGroup.java:303) at android.widget.FrameLayout.<init>(FrameLayout.java:80) at ti.modules.titanium.ui.widget.tableview.TiTableView.<init>(TiTableView.java:266) at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:106) at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1129) at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469) at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) at ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:146) at ti.modules.titanium.ui.TableViewProxy.handleSetData(TableViewProxy.java:689) at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:866) at android.os.Handler.dispatchMessage(Handler.java:95) at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:364) at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:349) at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:234) at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:261) at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:186) at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:740) at org.appcelerator.titanium.TiBaseActivity.onStop(TiBaseActivity.java:1058) at org.appcelerator.titanium.TiLaunchActivity.onStop(TiLaunchActivity.java:355) at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1272) at android.app.Activity.performStop(Activity.java:4073) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3127) ... 11 more {code} {code} Caused by: java.lang.NullPointerException at android.view.ViewConfiguration.get(ViewConfiguration.java:228) at android.view.View.<init>(View.java:1878) at android.view.ViewGroup.<init>(ViewGroup.java:281) at android.widget.FrameLayout.<init>(FrameLayout.java:80) at ti.modules.titanium.ui.widget.tableview.TiTableView.<init>(TiTableView.java:266) at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:106) at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1129) at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469) at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) at ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:146) at ti.modules.titanium.ui.TableViewProxy.handleSetData(TableViewProxy.java:689) at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:866) at android.os.Handler.dispatchMessage(Handler.java:95) at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:364) at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:349) at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:234) at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:261) at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:186) at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:740) at org.appcelerator.titanium.TiBaseActivity.onPause(TiBaseActivity.java:917) at org.appcelerator.titanium.TiLaunchActivity.onPause(TiLaunchActivity.java:339) at android.app.Activity.performPause(Activity.java:3851) at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191) at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2345) ... 12 more {code} h4. Test Case Unfortunately, I haven't been able to find steps to reproduce this issue. The best way to go forward in my opinion is to analyze the code and to try and figure out from there, what is going wrong. h4. My Analysis From the code I see, that in the TiTableViewConstructor a call to "super(proxy.getActivity())" is done. In "proxy.getActivity()" it is noted, that this may return "null". I assume that this would lead to the crash reports above. Could it be that we have a possible race condition or something similar here, where "proxy.getActivity()" is called, before the proxy actually has an activity assigned to it? Is anyone else seeing this problem on a large installation base? It would be great to improve the stability of Titanium further by fixing this issue.

    Appcelerator JIRA | 3 years ago | Philippe Wueger
    java.lang.NullPointerException
  3. 0

    Titanium – Gotcha with using events to update views in Android | Cyntech's Tech Blog

    wordpress.com | 2 months ago
    java.lang.RuntimeException: Unable to stop activity {au.edu.csu.mobile/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

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

    No message provided

    at android.view.ViewConfiguration.get()
  2. Android Platform
    FrameLayout.<init>
    1. android.view.ViewConfiguration.get(ViewConfiguration.java:228)
    2. android.view.View.<init>(View.java:1888)
    3. android.view.ViewGroup.<init>(ViewGroup.java:281)
    4. android.widget.FrameLayout.<init>(FrameLayout.java:80)
    4 frames
  3. ti.modules.titanium
    TiUITableView.processProperties
    1. ti.modules.titanium.ui.widget.tableview.TiTableView.<init>(TiTableView.java:266)
    2. ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:106)
    2 frames
  4. org.appcelerator.kroll
    KrollProxy.setModelListener
    1. org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1129)
    1 frame
  5. org.appcelerator.titanium
    TiViewProxy.getOrCreateView
    1. org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469)
    2. org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460)
    3. org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438)
    3 frames
  6. ti.modules.titanium
    TableViewProxy.handleMessage
    1. ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:146)
    2. ti.modules.titanium.ui.TableViewProxy.handleSetData(TableViewProxy.java:689)
    3. ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:866)
    3 frames
  7. Android Platform
    ActivityThread.main
    1. android.os.Handler.dispatchMessage(Handler.java:95)
    2. android.os.Looper.loop(Looper.java:130)
    3. android.app.ActivityThread.main(ActivityThread.java:3691)
    3 frames
  8. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:507)
    2 frames
  9. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
    2 frames
  10. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame