In a newly published game (android) that utilises a remote database to get data, I get daily many app crashes reports that I cannot reproduce or i have not encountered in my tests over several real devices and virtual devices. The top crash report is:
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2805)
at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2883)
at android.app.ActivityThread.-wrap11 (Unknown Source)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1613)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6523)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run
(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:857)
Caused by: java.lang.NullPointerException:
at com.my.app.activity.LevelActivity.onCreate (LevelActivity.java:82)
at android.app.Activity.performCreate (Activity.java:7023)
at android.app.Activity.performCreate (Activity.java:7014)
at android.app.Instrumentation.callActivityOnCreate
(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2758)
for example the LevelActivity.java:82 :
levelNo = MainActivity.dbHelper.GetLevelById(Constant.CATE_ID, Constant.SUB_CAT_ID);
and the oncreate until line with the NPE:
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level);
Utils.transparentStatusAndNavigation(LevelActivity.this);
layout = findViewById(R.id.layout);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
layout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
toolbar = findViewById(R.id.toolBar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.select_level);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
recyclerView.setLayoutManager(new LinearLayoutManager(LevelActivity.this));
levelNo = MainActivity.dbHelper.GetLevelById(Constant.CATE_ID, Constant.SUB_CAT_ID);
i don't know where to begin since I have never encountered this error or similar crash
All crashes related to this app are: java.lang.NullPointerException
this is not a duplicate question as the methods described in the proposed original question do not apply here.
I cannot reproduce the error, how can I debug?
Not all headaches can dissapear with aspirin