问题描述

我的项目下有多个模块,其中Server模块下的Server类调用Foo模块下的TCPConstants类报错,即多模块调用出错的问题。
使用IDEA给出的解决方式添依赖,确实不蹿红了
但运行时还是会报上边的错误(找不到符号)
在Project Structure中导入Module dependeccy也不行
报以上警告,运行还是报错
解决方案
在build.gradle中引用其他模块的名字时,可以用
compile project(':ModuleName')
来引用其他Module中的类,build,只要在Server的build.gradle中添加
compile project(':foo')
重新编译即可