Configure your Android Project
  • 22 Aug 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Configure your Android Project

  • Dark
    Light
  • PDF

Article summary

This project configuration guide explains how to install the vlplayer SDK into your Android app.

Setup

First, you'll need to install the VLPlayer SDK on your Android app.  

Generate access token for GitHub 

From your GitHub account, go to Settings -> Developer Settings -> Personal Access Tokens -> Generate new token.

Important
Once you generate your personal access token, make sure to copy it immediately. You will not be able to see it again, so it is important to keep it safe. The only way to get your token back is to regenerate it or create a new one.

Store your access token

  1. Create a github.properties file within your root Android project.
  2. In case of a public repository make sure you add this file to .gitignore to keep the token private.
  3. Add properties gpr.usr=GITHUB_USERID and gpr.key=PERSONAL_ACCESS_TOKEN 
  4. Replace GITHUB_USERID with personal / organisation Github User ID and PERSONAL_ACCESS_TOKEN with the token generated in #Step 1
gpr.usr=GITHUB_USERID
gpr.key=PERSONAL_ACCESS_TOKEN

Define githubProperties to read userid/token and Add maven dependency wherever you have declared repositories for your project(Project Gradle/Module Gradle)

def githubProperties = new Properties()
githubProperties.load(new FileInputStream(rootProject.file("github.properties")))


repositories {

    google()
    mavenCentral()

    maven {
        name = "GitHubPackages"
        
        url = uri("https://maven.pkg.github.com/snagfilms/androidplayer-sdk")
        credentials {
            /** Create github.properties in root project folder file with
             ** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN
             ** Or set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/

            username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
            password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
        }
    }
}

Note

If you are using the AAR file, you can skip the above configuration. Instead, you can simply add the AAR file as a dependency to your project. However, to download the AAR file, you will need to provide your GitHub username and access token.

Next, in your app/build.gradle file, include the following dependency:

// vlplayer sdk dependency 
implementation 'com.viewlift:vlplayer:2.4.3'



Was this article helpful?