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

在android 11 level 30的某些机型上有"Fragment " + this + " did not return a View from onCreateView() or this was called before onCreateView().”异常。 #37

Closed
censhengde opened this issue Nov 18, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@censhengde
Copy link

No description provided.

@censhengde
Copy link
Author

censhengde commented Nov 18, 2021

附:我是在DialogFragment onActivityCreated方法中第一次引用ViewBinding字段的

@DylanCaiCoding
Copy link
Owner

看描述是使用属性委托的用法吧,这是通过 Fragment 构造函数传入布局去 onCreateView() 的,按理来说只要布局没有漏传应该不会出现这个问题才对。有没有完整点的代码来康康吗?

@censhengde
Copy link
Author

看描述是使用属性委托的用法吧,这是通过 Fragment 构造函数传入布局去 onCreateView() 的,按理来说只要布局没有漏传应该不会出现这个问题才对。有没有完整点的代码来康康吗?

排查出来的,不是库的问题,是fragment状态问题,我在异步回调中使用binding操作了视图,而此时fragment已经销毁。

@DylanCaiCoding DylanCaiCoding added the enhancement New feature or request label Nov 19, 2021
@DylanCaiCoding
Copy link
Owner

已发布 1.2.6 版本优化该报错信息,在 Fragment 销毁后获取 binding 对象会报 "The binding property has been destroyed" 方便排查问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants