错误提示:

android.widget.RemoteViews$ActionException:
view: android.support.v7.widget.AppCompatImageView can’t use method with RemoteViews: setImageResource(int)

解决方法:

setting the appcompat version to ‘com.android.support:appcompat-v7:23.0.1’ or lower makes the error go away.

原因:

Issue:
android.support.v7.widget.AppCompatImageView introduced in version 23.1.0 of appcompat-v7 support library is missing the annotation:
@android.view.RemotableViewMethod for the following
methods:setImageResource(int)、setBackgroundResource(int)
Hence breaking RemoveViews#apply(Context, ViewGroup) when the remote view contains an ImageView and either of the above mentioned methods are called.

Details:
ImageView#setImageResource(int) and View#setBackgroundResource(int) are both annotated with @RemotableViewMethod annotation so it works with the RemoveViews API.

However since the @RemotableViewMethod annotation is not itself annotated as @Inherited, subclasses of ImageView and View classes when they override the 2 methods mentioned earlier (what AppCompatImageView did), the check for the RemotableViewMethod annotation in RemoveViews#getMethod(View, String, Class) fails for annotation not present.

更多相关文章

  1. OpenCV 连接 Android(安卓)IP摄像头
  2. Android开发错误信息收集
  3. 【android】Error: Static interface methods are only supporte
  4. Android(安卓)Sqlite Failed to open database(无法打开数据库文
  5. Android(安卓)studio b Error: No resource found that matches
  6. Android(安卓)Studio编译报错:sdk:minSdkVersion 1 cannot be sma
  7. Android中binderDied()以及"Unknown binder error code" 出现的
  8. android studio 3.0 报错 Unable to find method 'com.android.b
  9. android View.GONE 失效原因

随机推荐

  1. Android(安卓)用Shell命令设置静态ip
  2. Android(安卓)xxx is not translated in
  3. Android(安卓)相对布局(Relative Layout)
  4. Android中数据存储的5中方法
  5. Android缺少awk:安装busybox
  6. android摄像头调用资料收集
  7. Android深入浅出系列课程---Lesson6 AAF1
  8. Android(安卓)程序获取、设置铃声、音量
  9. Android(安卓)FileObserver 用法
  10. Android(安卓)Studio 使用Lambda表达式