官术网_书友最值得收藏!

Adding as a module

You can also add a library in Android Studio by adding it as a module. To add the module:

  1. First, place the library code in any folder of your choice
  2. Then, you need to Import the library as a module in your app. The figure below shows the steps to add the library as a Module:

This will open a new window where you need to select the library that you have saved to the directory. When you have selected the directory, click on Done. This will import the external library into your project.
As an example, I have added the module crop image to my project, which appears in my project folder.

Next, we need to add the module to the app's dependency list. To do this, right click on the module that has been added and click on the Open Module Settings option:

It will open a new window with your app module and library module in the list. Choose you app module, and then select the dependency list.

Next, click on the plus icon which will open another dialog with the module name. Select it and click OK:

This will build the Gradle and add the module to the build.gradle, and it will be seen as a compiled project here:

Note that Core, UI and Util sub projects can also have their own build.gradle file, depending on their specific needs. Alternatively, you can also define the dependencies of a project in the root build.gradle file, as discussed in the preceding section. In this case, we won't be focusing on these points.

主站蜘蛛池模板: 富宁县| 呼伦贝尔市| 南城县| 开鲁县| 宁国市| 太康县| 黄冈市| 襄樊市| 江北区| 新竹县| 泌阳县| 盐山县| 湾仔区| 邻水| 淮南市| 肥乡县| 紫云| 拉萨市| 乐昌市| 南乐县| 黄大仙区| 仁寿县| 德化县| 策勒县| 来凤县| 河间市| 张家界市| 石渠县| 德清县| 淮南市| 确山县| 马关县| 二手房| 辽源市| 龙山县| 攀枝花市| 松江区| 巴中市| 库车县| 永仁县| 获嘉县|