Android Legacy Installation
This document descrides legacy installation process. Since 1.4.0 Banuba SDK provides platform-specific packages. Packages should be preferred over archives.
Requirements
- Latest stable Android Studio
- Latest Gradle plugin
- Latest NDK
Get the client token and configuration file
To start working with the Banuba SDK in your project, you need to have the client token. To receive the client token please fill in our form on banuba.com, or contact us via info@banuba.com.
Together with the token, you will receive a configuration file config.json
which contains the required SDK resources defined by your token. Read more about this in Repack your SDK archive (minify SDK size) section.
Before building your project, place your client token inside the file: BanubaClientToken.java
Client token usage example
final class BanubaClientToken {
public static final String KEY = "YOUR_TOKEN_HERE";
private BanubaClientToken() {
}
}
Get the Banuba SDK archive
With the client token, you will also receive the Banuba SDK archive for Android which contains:
- Banuba Effect Player (compiled Android library project with .aar extension),
- Banuba SDK (compiled Android library project with .aar extension),
- Effect examples located under
effects
folder.
Repack your SDK archive (minify SDK size)
The SDK release archive contains all SDK resources by default. They may consume more disk space in the finished build.
To reduce the SDK size please use sdk_repacking.py
script provided with the SDK archive.
Please refer to SDK repacking readme in your SDK archive for more info and usage example.
After repacking your SDK archive you can try the usage of external resources. It can additionally reduce the size of the SDK.
Build your project with Banuba SDK
- Create the
libs
directory in your project and addbanuba_effect_player.aar
withbanuba_sdk.aar
.
- Open build.gradle (Module: app) and add Banuba SDK dependencies for your project
- Add
BanubaClientToken.java
to your project.
- In
Project Structure
checkDeclared Dependencies
Also, check our Android Demo app for some usable code snippets
Now you can run your project with BanubaSdk on your device
Minify the app size
After integration of Banuba SDK libraries banuba_effect_player.aar
, banuba_sdk.aar
your app size may increase significantly. It may happen if you use an 'android.tools' version earlier than classpath com.android.tools.build:gradle:3.5.0
. To minify your app size, update 'android.tools' to a newer version, e.g. classpath com.android.tools.build:gradle:4.0.1
. Then rebuild your application and check that "strip" phase exists in the build log (> Task :app:strip...
).
Build Demo App
Build the Banuba SDK Demo app
- Import the Android project under
src
folder in Android Studio.
- Select needed application for build.
- Select Build Variant from the left side menu in Android Studio.
Debug
build variant allows to properly debug and profile app during its execution.Release
build variant allows to test release variant of application (faster performance).
Demo app UI
Android Demo app UI description
- FPS Counter and active effect — shows the 3 counters of FPS in real-time and displays active effects.
FPS counters:
- Camera
- Face Recognition (FRX)
- Draw
- Frame Logger — 1st tap starts FPS log recording, 2nd tap ends FPS log recording. FPS log can be found in logcat output.
- Gallery — selection and processing photos from the gallery (continuous photo editing).
- Take HQ Photo — takes a high-quality photo (process image).
- Switch camera — switches between the front and rear cameras.
- Rec NoMask Video — 1st tap starts recording a video from camera, 2nd tap ends it. The recorded video can be found here:
/sdcard/Android/data/com.banuba.sdk.demo/cache
. - Photo/Video — tap to take a low-quality photo in the Photo mode (5), tap and hold to record a video in the Video mode (5).
- Switch mode - switches between the Photo and Video modes. When the Video mode is enabled, you can record videos with control 7.
- Effects selection — the slider control that shows all effects in the app.
- Add Effects — feature that allows to add new effects into Demo App more quickly using File Manager.
- Enable fixed FPS — allows to fix FPS by disabling autoexposition setting.
How to use Add Effects feature in Banuba SDK Demo app
- Download a folder with effect via Android Studio to device.
- Launch Demo App and tap '+' icon.
- Find the effect(s) downloaded in File Manager.
- Mark the folder(s) with checkbox and tap 'Select' button.
- Effect(s) appear in Demo app right after being added and can be applied.
Visit Getting Started for more examples of Banuba SDK usage for Android.