I'm attempting to setup my Android project in IntelliJ. I've never used it before, and I'm having some problems with module dependencies.
我试图在IntelliJ中设置我的Android项目。我以前从未使用过它,而且我在模块依赖方面有一些问题。
The project depends on several modules, which I have added in the Dependencies tab. IntelliJ detects them (i.e. there are no complaints in the code), but it fails at compile time with "package x.y.z does not exist." I have also tried checking "export" for the modules, but that seems to have no effect.
项目依赖于几个模块,我在Dependencies选项卡中添加了这些模块。IntelliJ检测到它们(也就是说,代码中没有任何抱怨),但是它在编译时却以“package x.y”失败。z是不存在的。”我也尝试过检查模块的“导出”,但似乎没有效果。
I saw this question which appears to be the same problem, but there was no solution.
我看到了同样的问题,但是没有解决的办法。
1 个解决方案
#1
11
Try adding your src as modules.
尝试添加src作为模块。
- File > Add Module
- 文件>添加模块
- Create Module from Existing Sources -> your_src_path_top_level
- 从现有资源创建模块——> your_src_path_top_level
- Next > Next > Finish
- 下一个>,下一个>结束
- File > Project Structure > Modules > YourApp
- >项目结构>模块> YourApp。
- plus button > Module Dependency > your_lib_you_added_earlier
- 加上按钮>模块依赖项> your_lib_you_added_early
- Use the up/down arrows to move to the bottom of the list
- 使用上下箭头移动到列表的底部
Here is a visual where I have added the Google Play src as a module.
这是我添加了谷歌作为模块的src的一个视觉效果。
#1
11
Try adding your src as modules.
尝试添加src作为模块。
- File > Add Module
- 文件>添加模块
- Create Module from Existing Sources -> your_src_path_top_level
- 从现有资源创建模块——> your_src_path_top_level
- Next > Next > Finish
- 下一个>,下一个>结束
- File > Project Structure > Modules > YourApp
- >项目结构>模块> YourApp。
- plus button > Module Dependency > your_lib_you_added_earlier
- 加上按钮>模块依赖项> your_lib_you_added_early
- Use the up/down arrows to move to the bottom of the list
- 使用上下箭头移动到列表的底部
Here is a visual where I have added the Google Play src as a module.
这是我添加了谷歌作为模块的src的一个视觉效果。