Skip to main content

Adding the Android SDK

Download the SDK and add the SDK to your Android project.

Version 0.0.65


To add a player to your app, you must import the VP Player SDK for Android and then configure your project. You can download the Android SDK using either Gradle or the local approaches listed below.

APPROACHNOTES
Gradle- No SDK download is required.
- Core and optional modules must be added to your app.
- ProGuard automatically applied. ProGuard protects the SDK classes.
- An existing app is required.
Local- VP Player SDK for Android must be downloaded and unzipped.
- Core and optional modules must be imported.
- ProGuard must be configured. ProGuard protects the SDK classes.
- An existing app is required.

Gradle

Import the SDK into your project with Gradle

  1. From within Android Studio, open your app.
  2. In the project build.gradle file
INFO

If your app uses depedencyResolutionManagement, add the code snippet below on the settings.gradle file.

settings.gradle
dependencyResolutionManagement{
repositories {
....
jcenter()
maven { url 'https://pkgs.dev.azure.com/gjirafadev/GjirafaSpecs/_packaging/AndroidLibraries/maven/v1'}
maven {
url 'https://pkgs.dev.azure.com/gjirafadev/VP/_packaging/Android/maven/v1'
credentials {
username "username"
password "password"
}
}
}
}
INFO

If your app use doesn't use dependencyResolutionManagement on settings.gradle, delete repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) and on the project build.gradle add the code snippet below.

build.gradle
buildscript{
repositories {
....
jcenter()
maven { url 'https://pkgs.dev.azure.com/gjirafadev/GjirafaSpecs/_packaging/AndroidLibraries/maven/v1'}
maven {
url 'https://pkgs.dev.azure.com/gjirafadev/VP/_packaging/Android/maven/v1'
credentials {
username "username"
password "password"
}
}
}
INFO

Replace username and password with your authentication key for VP Player repository.

  1. In the module build.gradle file, add the VP Player dependency.
build.gradle
dependencies {
implementation 'tech.gjirafa:player:Tag'
}
INFO

Replace Tag with latest version of VP Player.

  1. You also need to configure configure the compileOptions to support Java 8 language support and set multiDexEnabled true if your project is configured to minSdkVersion 21. If your minSdkVersion is less than 21, follow Google's instructions to add Multidex support prior to Android 5.0.
build.gradle
android {
defaultConfig {
...
minSdkVersion 21
multiDexEnabled true
}
...
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
  1. In the gradle.properties file, set _android.useAndroidX_ and _android.enableJetifier_ to true. These plugin files enable you to use androidx-namespaced libraries in your project.

    If you are using a current version of Android Studio, the gradle.properties file should already contain these settings.

gradle.properties
android.useAndroidX=true
android.enableJetifier=true
  1. Sync Gradle.

You have successfully imported the VP Player SDK for Android into your project. You can now configure the manifest file. If necessary, you can also configure ProGuard.

Local

Importing the SDK into your project

  1. Download the VPPlayer SDK
  2. From within Android Studio, open your app.
  3. Click File > New > Import Module
  4. Select player module from your computer
  5. Click Finish

Complete app and project configurations

  1. Add the following code snippet in build.gradle app.
build.gradle
implementation project(path: ':player')

You should also configure the compileOptions to support Java 8 language support and set multiDexEnabled to true if your project is configured to minSdkVersion 21. If your minSdkVersion is less than 21, follow Google's instructions to add Multidex support prior to Android 5.0.

build.gradle
android {
defaultConfig {
...
minSdkVersion 21
multiDexEnabled true
}
...
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
  1. In the gradle.properties file, set android.useAndroidX and android.enableJetifier to true. These plugin files enable you to use androidx-namespaced libraries in your project.

    If you are using a current version of Android Studio, the gradle.properties file should already contain these settings.

gradle.properties
android.useAndroidX=true
android.enableJetifier=true
  1. Sync Gradle

You have successfully imported the VP Player SDK for Android into your project. You can now configure the manifest file. If necessary, you can also configure ProGuard.