应用程序在java.lang.NullPointerException上崩溃:

时间:2017-10-05 11:00:26

标签: android methods crash

M使用#helpshift app崩溃或初始化帮助转移。请按照日志

java.lang.RuntimeException: Unable to start service com.helpshift.support.HSRetryService@1aba47b with Intent { cmp=com.quizup.core/com.helpshift.support.HSRetryService }: java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase$CursorFactory, android.database.DatabaseErrorHandler)' on a null object reference
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4079)
    at android.app.ActivityThread.access$2400(ActivityThread.java:221)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1897)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7224)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase$CursorFactory, android.database.DatabaseErrorHandler)' on a null object reference
    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
    at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187)
    at com.helpshift.support.storage.ProfilesDataSource.read(ProfilesDataSource.java:27)
    at com.helpshift.support.storage.ProfilesDataSource.getProfile(ProfilesDataSource.java:61)
    at com.helpshift.support.ProfilesManager.getProfile(ProfilesManager.java:25)
    at com.helpshift.support.ProfilesManager.getProfileId(ProfilesManager.java:34)
    at com.helpshift.support.HSApiData.getProfileId(HSApiData.java:2059)
    at com.helpshift.support.HSApiData.sendFailedMessages(HSApiData.java:1626)
    at com.helpshift.support.HSRetryService.onStartCommand(HSRetryService.java:17)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4062) 

1 个答案:

答案 0 :(得分:1)

检查ProfilesDataSource类中的第27行。 另请注释您的“ProfilesDataSource”类代码以获取更多帮助。