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

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.

主站蜘蛛池模板: 宜宾县| 富阳市| 永胜县| 张家川| 宁南县| 太保市| 兴义市| 会昌县| 焉耆| 池州市| 盐山县| 白玉县| 资阳市| 南岸区| 平乡县| 郴州市| 长岭县| 武冈市| 克拉玛依市| 梁河县| 齐齐哈尔市| 太谷县| 五大连池市| 通渭县| 平乡县| 彰化县| 灯塔市| 阿拉善右旗| 菏泽市| 临邑县| 新昌县| 方正县| 玛沁县| 湛江市| 乐平市| 农安县| 土默特右旗| 全南县| 朝阳区| 屏边| 新乡市|