2
因此,我剛剛創建了一個新應用程序,該應用程序引用了我的舊應用程序,並將其用作庫。你可以看到,問題/解決方案在這裏:從庫視圖錯誤中引用的小部件
但是我剛剛發現我的新的應用程序是給我的錯誤看法,當我嘗試,並設置了一些小部件,具有logcat的輸出,例如:
03-29 20:48:17.899: E/AppWidgetHostView(456): Package name com.nickavv.cleanwidgets not found
03-29 20:48:17.899: E/RemoteViews(456): Package name com.nickavv.cleanwidgets not found
03-29 20:48:17.960: W/AppWidgetHostView(456): updateAppWidget couldn't find any view, using error view
03-29 20:48:17.960: W/AppWidgetHostView(456): android.view.InflateException: Binary XML file line #18: Error inflating class com.android.launcher2.AllApps3D
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.widget.RemoteViews.apply(RemoteViews.java:930)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:219)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:155)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.appwidget.AppWidgetHost.createView(AppWidgetHost.java:218)
03-29 20:48:17.960: W/AppWidgetHostView(456): at com.android.launcher2.Launcher.completeAddAppWidget(Launcher.java:911)
03-29 20:48:17.960: W/AppWidgetHostView(456): at com.android.launcher2.Launcher.onActivityResult(Launcher.java:542)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.app.Activity.dispatchActivityResult(Activity.java:3890)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.app.ActivityThread.deliverResults(ActivityThread.java:3511)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.app.ActivityThread.access$2800(ActivityThread.java:125)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.os.Handler.dispatchMessage(Handler.java:99)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.os.Looper.loop(Looper.java:123)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-29 20:48:17.960: W/AppWidgetHostView(456): at java.lang.reflect.Method.invokeNative(Native Method)
03-29 20:48:17.960: W/AppWidgetHostView(456): at java.lang.reflect.Method.invoke(Method.java:521)
03-29 20:48:17.960: W/AppWidgetHostView(456): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-29 20:48:17.960: W/AppWidgetHostView(456): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-29 20:48:17.960: W/AppWidgetHostView(456): at dalvik.system.NativeStart.main(Native Method)
03-29 20:48:17.960: W/AppWidgetHostView(456): Caused by: android.view.InflateException: Binary XML file line #18: Class not allowed to be inflated com.android.launcher2.AllApps3D
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.view.LayoutInflater.failNotAllowed(LayoutInflater.java:525)
03-29 20:48:17.960: W/AppWidgetHostView(456): at android.view.LayoutInflater.createView(LayoutInflater.java:472)
這是怎麼回事?謝謝
奇怪,我已經有了getPackageName,並且它在日誌中打印了正確的包名,並且有時在我升級應用程序之後(或者只是運行它在來自AndroidStudio的設備上)小部件消失。之後它在另一次升級後回來 – Gavriel 2016-03-02 14:03:46