“_Problem Loading Widget” message

2019-01-22 17:36发布

When loading a widget if it cannot find a resource or something it says Problem Loading Widget. That's all! Amazing! This message remains on the home screen and does not even say which widget it had trouble loading.

I figured it out by trial and error but I would like to know if there are any places to find the error message when this occurs. Where will Android say what problem it had loading the widget or even which widget it failed to load?

18条回答
甜甜的少女心
2楼-- · 2019-01-22 17:42

I was also having the same problem -

I was using android.support.constraint.ConstraintLayout that's why it was saying "Problem loading widget" after removing this and changing to LinearLayout problem solved as @Gangnus saying, it will work for only specific views only.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-22 17:45

I faced this problem because I was trying to use Check-box!

So,just remove checkbox.

it will work fine.

查看更多
三岁会撩人
4楼-- · 2019-01-22 17:47

Check elements you used in the view in a Widget..

Documentation link

A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:

  • FrameLayout
  • LinearLayout
  • RelativeLayout
  • GridLayout

And the following widget classes:

  • AnalogClock
  • Button
  • Chronometer
  • ImageButton
  • ImageView
  • ProgressBar
  • TextView
  • ViewFlipper
  • ListView
  • GridView
  • StackView
  • AdapterViewFlipper

Using forbidden elements causes this very

Problem Loading Widget

message, without saying where did it happen.

查看更多
一纸荒年 Trace。
5楼-- · 2019-01-22 17:47

Problem Loading the widget results from problem/s in your widget layout!

There are only limited amount of resource you can use in the widget.Make sure you use the proper elements and their fields.

A RemoteViews object (and, consequently, an App Widget) can support the following ... widget classes:

AnalogClock
Button
...

Developer docs

My problem was: I had this Button's field which was not supported

android:onClick="onClick" 

Deleting this enabled the widget to appear where placed (if placed previously) and in the menu of available widgets.

In fact setting android:onClick= for any View results in this error.

查看更多
神经病院院长
6楼-- · 2019-01-22 17:48

In my case I had a floating textView over other views. Removing it and thinking of a different way of showing my info to the user with the existing views that are not overlapping was the solution.

So don't overlap views with RelativeLayout, I still use it and it works, but the views are not overlapping as much as possible.

查看更多
在下西门庆
7楼-- · 2019-01-22 17:51

In my case error was caused by changed provider class name. So if you have changed the name of Widget Provider class, try to change it back. Also, if you have changed the names of xml files (ex. widget_info.xml, widget_layout.xml), you might want to change those back as well.

This happened only when user updated app and "old" widget was currently visible.

查看更多
登录 后发表回答