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

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.

主站蜘蛛池模板: 都匀市| 台州市| 常熟市| 礼泉县| 徐水县| 遂宁市| 正镶白旗| 漯河市| 景泰县| 宁乡县| 民丰县| 巩留县| 昭通市| 巫山县| 富源县| 桐城市| 扶余县| 富蕴县| 新平| 大名县| 偏关县| 永登县| 沙雅县| 灵宝市| 广东省| 蕲春县| 新源县| 阿荣旗| 鄱阳县| 嘉义市| 高邑县| 无为县| 定远县| 容城县| 呼和浩特市| 宁陵县| 仁寿县| 昆明市| 天长市| 嵩明县| 三门峡市|