Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addType<Int>报错 #377

Closed
1Ezreal opened this issue Jul 10, 2023 · 7 comments
Closed

addType<Int>报错 #377

1Ezreal opened this issue Jul 10, 2023 · 7 comments
Labels
Bug Something isn't working

Comments

@1Ezreal
Copy link

1Ezreal commented Jul 10, 2023

问题描述

addType(R.layout.item_integral_sign)
Int类型报错,改为String/Integer类型正常

期望行为

正常

如何复现

任何业务相关问题没有fork仓库复现问题一律无法解决, 凭空猜测只会让问题晦涩难懂, 大量耽误项目维护时间

截图

异常堆栈信息或者手机截图/视频(拖拽到输入框即可上传)
android.util.NoSuchPropertyException: Please add item model type : addType<java.lang.Integer>(R.layout.item)
at com.drake.brv.BindingAdapter.getItemViewType(BindingAdapter.kt:197)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6608)

版本

  • BRV:1.4.2
  • Android:9
  • Gradle: 7.4.2
  • Android Studio:2022.2.1 Patch 2
@1Ezreal 1Ezreal added the 寻求帮助 Extra attention is needed label Jul 10, 2023
@liangjingkanji
Copy link
Owner

liangjingkanji commented Jul 10, 2023

这个错误是addType的泛型和models里面的元素类型对应不上, 我不知道你集合里面是否有添加Integer(Kotlin里面不存在这个类型)

如果还有问题请fork仓库复现此问题发给我链接(你自己将sample里面的类型改为Int就可以知道到底报不报错了)

这种简单问题请先自己运行试下, 我不希望回答太多这种问题浪费维护框架时间

@1Ezreal
Copy link
Author

1Ezreal commented Jul 10, 2023

1.4.0并不会出现这个问题,我写个demo试试是否是项目问题导致

@1Ezreal
Copy link
Author

1Ezreal commented Jul 10, 2023

改了Sample中 SimpleFragment的
addType SimpleModel->Int
直接报错
android.util.NoSuchPropertyException: Please add item model type : addType<java.lang.Integer>(R.layout.item)
at com.drake.brv.BindingAdapter.getItemViewType(BindingAdapter.kt:197)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6367)

@1Ezreal
Copy link
Author

1Ezreal commented Jul 10, 2023

image
image

@liangjingkanji
Copy link
Owner

的确存在这个问题, 和我为了适配集合泛型多类型需求有关, 该问题会在近期修复

@liangjingkanji liangjingkanji added Bug Something isn't working and removed 寻求帮助 Extra attention is needed labels Jul 15, 2023
@liangjingkanji
Copy link
Owner

你应该知道该bug已经早就被修复了吧

@1Ezreal
Copy link
Author

1Ezreal commented Jul 25, 2023

看到更新了0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants