Java – how do I use a project in another project as a module?

I want to modularize the Android project so that it is easy to maintain in the future I wonder if it is possible to use an Android project as a module in another Android project?

For example, suppose that in my main Android project, I have three buttons for logging in, registering, and forgetting my password I have three separate projects for logging in, registering and forgetting passwords, as well as their own views, activities and libraries How do I use these individual Android projects in the main Android project so that when I click any of the three options in the main activity view, it will load the relevant views from the three module projects? (click the login button in the main view and load the login view from a separate login project activity) I tried to fiddle with building files and library module imports, but I couldn't If this method is feasible, please tell me? If possible, how?

Solution

Settings in the root project Gradle includes each item

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 main module

implementation project(':loginApp')
implementation project(':signupApp')
implementation project(':resetpasswordApp')
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>