我写了一个android
App Widget,它运行正常。过了一段时间我不得不改变它的包名但它运作良好。我已经有了getPackageName
,它在日志中打印了正确的包名,有时在我升级应用程序之后(或者只是在AndroidStudio
设备上运行它),小部件就会消失。后来又在升级后又回来了。
这是我的logcat:
06-20 14:59:31.208 23516-23516 /? E / InstalledAppDetails:检索包时出现异常:ir.yasin.dordane.rozshomar_widget
android.content.pm.PackageManager$NameNotFoundException: ir.yasin.dordane.rozshomar_widget
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:115)
at com.android.settings.applications.InstalledAppDetails.retrieveAppEntry(InstalledAppDetails.java:723)
at com.android.settings.applications.InstalledAppDetails.refreshUi(InstalledAppDetails.java:758)
at com.android.settings.applications.InstalledAppDetails.onActivityResult(InstalledAppDetails.java:595)
at android.app.Activity.dispatchActivityResult(Activity.java:6139)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3564)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3611)
at android.app.ActivityThread.access$1400(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
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:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)