Android studio add external project to build.gradle

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.

Leave a Comment