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

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.

主站蜘蛛池模板: 安新县| 乌拉特前旗| 监利县| 河间市| 樟树市| 武山县| 会理县| 南丹县| 隆昌县| 永定县| 阜宁县| 卢龙县| 通渭县| 崇左市| 和顺县| 绥阳县| 信丰县| 日喀则市| 赣榆县| 水富县| 金坛市| 黎川县| 云龙县| 乌兰察布市| 蕉岭县| 班戈县| 贵南县| 会宁县| 天津市| 射阳县| 普宁市| 新乡市| 饶平县| 韶关市| 来凤县| 龙南县| 芷江| 宣化县| 沙雅县| 台江县| 五华县|