Android studio add external project to build.gradle | Newbedevz
实际操作:
讲的很清楚,不需要图形界面导入。直接修改settings.gradle,如果没有,直接创建一个。然后加“
include ':module1'
project(':module1').projectDir = new File(settingsDir, '../Project B/Module 1') “
dependence,也许gradle可以加,之前貌似还在project structrue成功过。本次成功是发现没有依赖库文件导致编译不通过,直接找到对应代码自动修复。
Assuming that Some Other Folder is a gradle project you could add something like the following to your settings.gradle file:
include ':module1'
project(':module1').projectDir = new File(settingsDir, '../Project B/Module 1')
You have to put in your file settings.gradle this lines:
include ':module2'
project(':module2').projectDir = new File(settingsDir, '../Project 2/Module2')
Then you have to add in your builde.gradle (Module: app) in the dependencies tree, this line:
implementation project(':module2')
or go into the Project Structure > app > Dependencies, click on Add, choose 3 Module Dependencies and select your module
Right click on project - Select "Open Module Settings" - Select "Modules" in left pane - Click on "+" symbol on top - Choose "Import Module".
After importing Module. You need to add it as a dependency for your current project.
Keep "Modules" Selected in left pane and click on your project - Now Go in dependencies tab and click on "+" symbol that is located at bottom - Choose third option "Module Dependencies" and if you have imported your project correctly, it will show you the all available module that can be added as a dependency to your current project.