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
Layout文件有依赖关系,改变子文件编译会报Unresolved reference #24
Comments
@MarkMjw app module是否有 加入 viewBinding = true |
有的。 |
@MarkMjw 这个是运行时报错?第二次编译启动 app npe ,你尝试第二次手动打开 app 是否还会报错?之前我这边也遇到这个问题。确认一下是不是同个问题? |
不是APP启动而是编译报错。 我在官方项目中添加两个module能够复现此问题。 完整demo RocketXPlugin.zip |
好的,感谢,我这边尝试一下哈。 |
@MarkMjw 大概知道问题,include 了base 模块的xml ,在 base 打成aar 后,这个include 布局被转成 View (正确应该是 baseBinding) 导致引用得不到recycleview |
@MarkMjw 需要时间研究一下怎么解决。你急的话可以改掉跨模块使用 include |
不急,辛苦研究,我也看看 |
rebuild 就可以了 |
是不是要从源头上解决一下,这样操作太麻烦了 |
@LatlngV 遇到这个问题,应该只需要clean 一次。后面都正常了。 xxxBinding 生成的操作,不是 gradle 做动作,是一个 intellij plugin 内置在 AS 里面,类似本项目的 rocketX-studio-plugin ,无法干预。 只能看看有无其他办法。 |
@MarkMjw org.gradle.caching=true 有无设置都一样。只要修改了 xml 就会重新生成对应的 layoutbinding,如果刚好使用 include 了其他module 的xml (其他module 变成 aar)。这个include 就会被 viewbind 转成 VIEW 。目前有两种缓解的做法: 1、如果非常多的模块 都是使用 include 了 baseui 中的 xml ,可以通过 excludeModule = [":baseui"] 强制不打成 aar (就多一个模块不打 aar ,整体速度影响不大) 这一块问题可能需要持续的研究。目前没想到好的办法解决呢。 |
OK,暂时也只能先exclude了。 |
@MarkMjw 如果有想到好的办法,欢迎提PR ,感谢! |
依赖关系:app->module和base,module->base,各模块都开启
viewBinding
。base中有layout如:
在module中有layout如:
module中有Activity如下:
首次可以成功run,此时改变module中layout文件(如:增加一个TextView)
再次run:
binding.list.recyclerView
这里报错:Unresolved reference: recyclerViewThe text was updated successfully, but these errors were encountered: