ming300
ming300
  • 发布:2016-07-13 09:05
  • 更新:2016-07-13 09:22
  • 阅读:1712

【报Bug】DeviceInfo.checkCoverInstallApk()报错

分类:5+ SDK

Android-SDK@1.9.9.24785_20160708

当调用DeviceInfo.checkCoverInstallApk()后会报以下错误.

{{{

W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.SharedPreferences android.content.Context.getSharedPreferences(java.lang.String, int)' on a null object reference
W/System.err: at io.dcloud.common.adapter.util.SP.getOrCreateBundle(SP.java:106)
W/System.err: at io.dcloud.common.adapter.util.SP.getBundleData(SP.java:86)
W/System.err: at io.dcloud.common.util.TelephonyUtil.getIMEI(TelephonyUtil.java:56)
W/System.err: at io.dcloud.common.util.TelephonyUtil.getIMEI(TelephonyUtil.java:31)
W/System.err: at io.dcloud.common.adapter.util.UEH.commitBaseUncatchInfo(UEH.java:144)
W/System.err: at io.dcloud.common.adapter.util.UEH.commitUncatchException(UEH.java:173)
W/System.err: at io.dcloud.common.adapter.util.UEH.access$000(UEH.java:33)
W/System.err: at io.dcloud.common.adapter.util.UEH$1.uncaughtException(UEH.java:54)
W/System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
W/System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
W/System.err: java.lang.RuntimeException: Unable to create application com.ccesun.health.android.input.Application: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.SharedPreferences android.content.Context.getSharedPreferences(java.lang.String, int)' on a null object reference
W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4607)
W/System.err: at android.app.ActivityThread.access$1500(ActivityThread.java:159)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:135)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5313)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1116)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:809)
W/System.err: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.SharedPreferences android.content.Context.getSharedPreferences(java.lang.String, int)' on a null object reference
W/System.err: at io.dcloud.common.adapter.util.SP.getOrCreateBundle(SP.java:106)
W/System.err: at io.dcloud.common.adapter.util.SP.getBundleData(SP.java:86)
W/System.err: at io.dcloud.common.adapter.util.DeviceInfo.checkCoverInstallApk(DeviceInfo.java:648)
}}}

2016-07-13 09:05 负责人:无 分享
已邀请:
ming300

ming300 (作者)

解决办法:事先调用初始化即可.
{{{
DeviceInfo.initPath(ctx);
DeviceInfo.init(ctx);
}}}

该问题目前已经被锁定, 无法添加新回复