Here I use the library project named Common, where the module named Common.
The first step is to modify the Settings.gradle file under the main project.
Include ': App ', ': Common '
Project (': Common '). ProjectDir = new File ('.. /common/common ')
Here: Common is the module name of the library project, behind the '. /common/common ' is the path to the module. Here my main engineering and library projects are under the Androidstudioproject folder.
The second step is to modify the build.gradle of the main engineering app and add the Library project reference.
dependencies {
Compile Filetree (include: [' *.jar '], dir: ' Libs ')
Compile project (': Common ')
}
Then, build the project, the Library project was successfully introduced. At this point, we can find that in the engineering catalogue, common is also joined and displayed alongside the main project.
If we try to open the Library project in a new window and make changes, when we cut back to the main project, we will find that the referenced library project has also been modified. This achieves the same effect as the Library project reference in Eclipse.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How Android studio Imports library projects