java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yuehu.cola.projectcola/com.yuehu.cola.projectcola.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • App crashing Android/iOS
    via GitHub by aamarcha
    ,
  • java.lang.NullPointerException
    via GitHub by e-yes
    ,
  • java.lang.NullPointerException
    via GitHub by banobi
    ,
  • java.lang.NullPointerException
    via GitHub by banobi
    ,
  • 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.
    via by Philippe Wueger,
    • java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yuehu.cola.projectcola/com.yuehu.cola.projectcola.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference at android.view.ViewConfiguration.get(ViewConfiguration.java:359) at android.view.View.<init>(View.java:3587) at android.view.View.<init>(View.java:3682) at android.view.ViewGroup.<init>(ViewGroup.java:497) at android.view.ViewGroup.<init>(ViewGroup.java:493) at android.view.ViewGroup.<init>(ViewGroup.java:489) at android.view.ViewGroup.<init>(ViewGroup.java:485) at android.widget.FrameLayout.<init>(FrameLayout.java:103) at com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter.setMore(RecyclerArrayAdapter.java:223) at com.yuehu.cola.projectcola.ui.fragments.FragmentYuehu.initViews(FragmentYuehu.java:70) at com.yuehu.cola.projectcola.ui.fragments.FragmentYuehu.onCreateView(FragmentYuehu.java:62) at android.app.Fragment.performCreateView(Fragment.java:2053) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:894) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) at android.app.BackStackRecord.run(BackStackRecord.java:834) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452) at android.app.Activity.performStart(Activity.java:6005) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)

    Users with the same issue

    Unknown visitor2 times, last one,
    Unknown visitor1 times, last one,
    maxxi
    maxxi1 times, last one,
    Nisha Singh
    Nisha Singh5 times, last one,
    brunosatriani
    brunosatriani13 times, last one,
    4 more bugmates