This article sources you I study Web article address https://www.niwoxuexi.com/blog/android/article/244.html
We are in the development of the module in the Android studio in the package into a library convenient modules reference to share with the team I have a small case here to demonstrate
Case development a Logutil log printing class is not much of a demonstration development
If there are two module in a project
650) this.width=650; "src=" Https://image.niwoxuexi.com/blog/content/ec06e33911-lib01.png "style=" border:0px; Vertical-align:middle; "alt=" Ec06e33911-lib01.png "/>
We're going to turn mylib module into a library now.
First, first modify the Mylib module under the Build.gradle file in the Apply plugin: ' com.android.application ' modified to apply plugin: ' Com.android.library '
650) this.width=650; "src=" Https://image.niwoxuexi.com/blog/content/1f468100a4-lib2.png "width=" 747 "height=" 398 " Style= "BORDER:0PX;VERTICAL-ALIGN:MIDDLE;WIDTH:747PX;HEIGHT:398PX;" alt= "1f468100a4-lib2.png"/>
Second, remove the ApplicationID attribute in Build.gradle This is Mylib has become a library
650) this.width=650; "src=" Https://image.niwoxuexi.com/blog/content/9d8ed2c9ae-lib3.png "width=" 737 "height=" 394 " Style= "BORDER:0PX;VERTICAL-ALIGN:MIDDLE;WIDTH:737PX;HEIGHT:394PX;" alt= "9d8ed2c9ae-lib3.png"/>
Third, refer the mylib to the Appmodule project as shown in the steps
650) this.width=650; "src=" Https://image.niwoxuexi.com/blog/content/80b85b5fbf-lib4.png "width=" 722 "height=" 540 " Style= "border:0px;vertical-align:middle;width:722px;height:540px;" alt= "80b85b5fbf-lib4.png"/>
650) this.width=650; "src=" Https://image.niwoxuexi.com/blog/content/0f8dd9f733-lib5.png "width=" 721 "height=" 513 " Style= "BORDER:0PX;VERTICAL-ALIGN:MIDDLE;WIDTH:721PX;HEIGHT:513PX;" alt= "0f8dd9f733-lib5.png"/>
Iv. Operational Results
650) this.width=650; "src=" Https://image.niwoxuexi.com/blog/content/97ce27f2bc-lib7.png "width=" 726 "height=" 518 " Style= "BORDER:0PX;VERTICAL-ALIGN:MIDDLE;WIDTH:726PX;HEIGHT:518PX;" alt= "97ce27f2bc-lib7.png"/>
Well, we succeeded in calling the package in Mylib in the app module.
Finally put the code Https://image.niwoxuexi.com/blog/download/MyApp.zip
This article is from the "Full stack Development" blog, please be sure to keep this source http://andy2290.blog.51cto.com/13193207/1960717
Android Studio changes module to library