How to use a project in another project as a module?

Pixxu Waku :

I'm hoping to modularize an Android project so it will be easy to maintain in future use. I want to know whether its possible or not, to make an Android project used as a module within another Android project?

For example, let's say in my main android project I have three buttons for login, signup, forget password. and I have three separate projects for login, signup and forget password with their own views, activities and libraries. How can I use these separate android projects in the main Android project so when I click any of the three options in the main activity view so it will load the relevant view from those three module projects? (click the login button in the main view and load login view from the separate login project activities). I have tried to fiddle with build files and library module importing but couldn't do it. help me with saying if this approach is possible or not? if possible how to achieve it?

Khaled Lela :

settings.gradle in root project include each project.

include ':loginApp'
include ':signupApp'
include ':resetpasswordApp'

project(':loginApp').projectDir = file('path/to/LoginApp')
project(':signupApp').projectDir = file('path/to/SignupApp')
project(':resetpasswordApp').projectDir = file('path/to/ResetpasswordApp')

build.gradle Of main module

implementation project(':loginApp')
implementation project(':signupApp')
implementation project(':resetpasswordApp')

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=87176&siteId=1