Adding external library in Android studio

前端 未结 19 1128
面向向阳花
面向向阳花 2020-11-22 05:51

I want to add external library https://github.com/foursquare/foursquare-android-oauth to my Android application (I use Android Studio, the instructions provided by lib autho

相关标签:
19条回答
  • 2020-11-22 06:39

    If the library you need is on GitHub then adding it to Android Studio is easy with JitPack.

    Step 1. Add the jitpack repository to build.gradle:

    allprojects { 
      repositories {
        jcenter()
        maven { url "https://jitpack.io" }
      }
    }
    

    Step 2. Add the GitHub repository as a dependency:

    dependencies {
        // ...
        compile 'com.github.Username:LibraryRepo:ReleaseTag'
    }
    

    JitPack acts as a maven repository and can be used much like Maven Central. The nice thing is that the maintainers don't have to upload the library. Behind the scenes JitPack will check out the code from GitHub and compile it. Therefore for this to work there needs to be a working build file in the git repository.

    There is also a guide on how to publish an Android library.

    0 讨论(0)
提交回复
热议问题