我有我的buyer,seller模块和common模块.两个buyer和seller模块中使用的布局很少放在common模块中.
common -> layout_toolbar.xml
buyer -> activity_sell.xml ->
<LinearLayout>
<include layout="@layout/layout_toolbar" /> <!-- layout_toolbar.xml is from common module -->
</LinearLayout>
seller -> activity_buy.xml ->
<RelativeLayout>
<include layout="@layout/layout_toolbar" /> <!-- layout_toolbar.xml is from common module -->
</RelativeLayout>
buyer -> BuyActivity.kt
toolbar.title = "Buy"
seller -> SellActivity.kt
toolbar.title = "Sell"
Run Code Online (Sandbox Code Playgroud)
在IDE中一切正常
但每当我尝试构建应用程序时,它会给我编译错误:
Unresolved reference: toolbar <-- Id of the toolbar inside layout_toolbar.xml
Run Code Online (Sandbox Code Playgroud)
如果IDE可以正确解析依赖关系,为什么不能构建gradle?有什么我做错了吗?
请注意,common模块与implementation其他两个模块一样添加.但我尝试 …