How to create a library on Github and use it through gradle dependencies in Android Studio

前端 未结 3 911
独厮守ぢ
独厮守ぢ 2020-12-13 03:19

I want to create the library and have access to it through the Internet. In Android Studio (via Gradle) dependency may be added in this way:

In build.gradle

3条回答
  •  一向
    一向 (楼主)
    2020-12-13 03:21

    For a quick solution, as the others have said JitPack is probably the way to go. However, if you want to make your library available to a wider audience you should probably add it to jcenter since this is set up by default in Android Studio now. (Previously it was Maven Central.)

    This post gives a detailed walkthrough of how to do it. The following is a summary:

    1. Create the Android library
    2. Test to make sure the library is usable locally
    3. Publish the library on Bintray
    4. Add the library to Jcenter

    Then all people will have to do to use your library is add a one liner to their build.gradle dependencies.

提交回复
热议问题