我编写了一个android
App Widget,它工作正常。一段时间后,我不得不更改它的包名,但它运行良好。我已经有了getPackageName
,它会在日志中打印正确的包名称,但有时在我升级应用程序(或者只是在设备上运行它AndroidStudio
)之后,小部件就会消失。后来它在另一次升级后又回来了。这是我的日志: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)