How to install a library using JitPack

How to install a library using JitPack

Installing a library with JitPack is easy as pie! If you already have an Android project, just add two lines to your gradle config files and it's done! Let’s see in detail how to import and use a specific Pepper library.

How to add the JitPack repository to your project

Apply the two following steps to add a Git project into your project build:

  1. First, add a reference to the JitPack repository to your root build.gradle file.
    Open the project build.gradle file and add the reference to https://jitpack.io at the end of the repositories section. It should look like this:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Then, add the dependency to the package you want to install, in the build.gradle (“Module: app”) file by adapting the Tag value. It should look like this:
dependencies {
     ...
     implementation 'ext.package.id:my-lib-name:Tag'
    }

And that's it! The first time you request a project, JitPack will check out the code, build it, and create the build artifacts (jar, aar).

Now let’s try and integrate a public library from SoftBank Robotics.

Integrating a SoftBank Robotics public library using JitPack

SoftBank Robotics developed several ready-to-use libraries hosted on SoftBank Robotics Labs GitHub account. At the time this article is published, a few libraries have already been published for everyone to use:

  • Pepper Solitaries Loop, How to attract people with animation loops
  • Pepper Core Animations, Special animation library you won't find in the android plug-in
  • Pepper Point at, How to make Pepper point at specific directions
  • Code Scanner, How to scan QR codes and barcodes with Pepper
  • Pepper Gamepad, Control your Pepper remotely
  • ArUco markers, How to localize and navigate
  • Etc.

Find out how easy it is to use them!

How to integrate a public library

JitPack is really easy to use and works with any GitHub library. Let’s say you want to use the “Pepper Gamepad” remote control library in your project.

  1. Go to Softbank Robotics Labs on GitHub and grab the URL: https://github.com/softbankrobotics-labs/pepper-gamepad
  2. Go to https://jitpack.io/ and look for the repository using this URL. This will give you a list of releases, tags, branches etc. to use
    JitPack Screenshot
    JitPack Screenshot
  3. We recommend choosing the Latest Release, as it indicates that this version has been approved and is ready to use. Press “Get It” and the instructions will appear below.
  4. In your root build.gradle file, add the following:
allprojects {
repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

  1. In your project gradle file, add the line generated by the JitPack website, in this case:
dependencies {
            implementation 'com.github.softbankrobotics-labs:pepper-gamepad:1.0.3'
    }

  1. Sync your gradle files, and that’s it! All the code from this specific library is now available in your project. You can also use this method to check out experimental or test branches.

Now you just have to add a few lines of code to fully integrate the Pepper Gamepad library to your own project: follow the detailed instructions in the Usage section of the README file on Github.

Pepper Gamepad in action

Green Guy with glasses
Louis-Gabriel POUILLOT
Senior Software Engineer