Android:Gradle编译错误要求元素值为常量表达式 - 特征模块

问题描述 投票:0回答:1

这是我的第一个多模块项目。

此登录活动存在于功能模块中,该功能模块从基本功能模块获取其许多依赖项。

我在我使用带有TextInputEditText和Button的error: element value must be a constant expression的行上得到错误@BindView

此外,我注意到R类的导入缺失,但没有一个R.id.是红色的。这是为什么?

enter image description here

java android android-jetpack android-instant-apps
1个回答
3
投票

功能模块类似于库模块。从应用程序模块移动到库/要素模块后,R类字段不再是最终常量。这就是问题发生的原因。要解决这个问题,你需要切换到Butterknife的R2课程。

以下链接中的更多信息:

© www.soinside.com 2019 - 2024. All rights reserved.