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.
APPROACH | NOTES |
---|---|
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
- From within Android Studio, open your app.
- In the project build.gradle file
If your app uses depedencyResolutionManagement
, add the code snippet below on the settings.gradle file.
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"
}
}
}
}
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.
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"
}
}
}
Replace username and password with your authentication key for VP Player repository.
- In the module build.gradle file, add the VP Player dependency.
dependencies {
implementation 'tech.gjirafa:player:Tag'
}
Replace Tag with latest version of VP Player.
- You also need to configure configure the
compileOptions
to support Java 8 language support and setmultiDexEnabled
true if your project is configured to minSdkVersion 21. If yourminSdkVersion
is less than 21, follow Google's instructions to add Multidex support prior to Android 5.0.
android {
defaultConfig {
...
minSdkVersion 21
multiDexEnabled true
}
...
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
In the gradle.properties file, set
_android.useAndroidX_
and_android.enableJetifier_
totrue
. 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.
android.useAndroidX=true
android.enableJetifier=true
- 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
- Download the VPPlayer SDK
- From within Android Studio, open your app.
- Click File > New > Import Module
- Select player module from your computer
- Click Finish
Complete app and project configurations
- Add the following code snippet in build.gradle app.
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.
android {
defaultConfig {
...
minSdkVersion 21
multiDexEnabled true
}
...
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
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.
android.useAndroidX=true
android.enableJetifier=true
- 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.