Managing Vsdk Assets - Android
Introduction
Before using any voice technology such as ASR, TTS, Speech Enhancement, or Biometrics, the Vsdk requires its assets to be present on the device’s file system. These assets include models, configuration files, and other data essential for the correct operation of the engines.
There are two main ways to provide these assets on the device:
Bundling the Vsdk assets in your APK and extracting them at runtime.
Hosting the Vsdk assets remotely and downloading them as needed.
Each method has trade-offs in terms of storage usage, app size, and update flexibility.
Creating and Exporting VDK-Studio Project
Currently, you cannot export a VSDK project directly from the online VDK Studio. Only VDK Service exports are supported at this time.
Before exporting, you’ll first need to create a VDK-Studio project. To do this, follow our dedicated setup guide. For the purpose of this integration, you don’t need to configure any specific technologies—exporting a project with whatever technology you have access.
You need to create a project with VSDK, not with VDK-Service!
When exporting your project:
Select Android as the target platform.
Set the target folder to your Android project’s
app/src/main/directory if you want to bundle them with your apk. You can also host this files and download them directly to the device file system.
After the export completes, you will see the following folder structure inside your Android project:
# VDK-Studio >=5.9.1
app/src/main/
└── assets/
└── vsdk/
├── config/
│ └── vsdk.json # VSDK configuration file
└── data/ # Contains required voice technology resources
Option 1 – Including Assets in the APK (Test-Only)
This method is recommended for testing or development only. Avoid using it in production.
In this approach, the Vsdk assets are packaged directly inside your APK or App Bundle and extracted to the device’s file system at runtime.
Characteristics
Assets are available immediately after installation.
Increases the APK size significantly.
Requires double the storage space on the user’s device (one copy inside the APK and another extracted copy).
Typical Workflow
Place the Vsdk assets in your project’s
app/src/main/assets/vsdkdirectory.On application startup, extract the assets to the desired path on the file system.
Initialize the Vsdk using the path where the assets were extracted.
Example
try {
Log.i(TAG, "Extracting Assets");
final String vsdkDataPath = getFilesDir().getAbsolutePath() + Constants.vsdkPath;
com.vivoka.vsdk.util.AssetsExtractor.extract(this, "vsdk", vsdkDataPath);
} catch (Exception e) {
e.printFormattedMessage();
}
The assets extractors extracts the data synchronously avoid using the UI thread when calling the extract method.
Option 2 – Hosting Assets Remotely (Recommended)
Recommended for production environments.
In this approach, the Vsdk assets are hosted externally (e.g., on a secure server, CDN, or cloud storage such as Firebase or AWS S3). The application downloads only the necessary assets to the device file system before initialization.
Advantages
Keeps the APK lightweight and reduces installation size.
Allows dynamic content updates without requiring an app update.
Saves approximately 50% of storage space compared to bundling assets in the APK.
Supports on-demand loading, so users only download what they need.
Typical Workflow
Host the Vsdk assets on your server or content delivery platform.
Implement an asset management mechanism to:
Check if required assets are already downloaded.
Download missing assets and store them on the device.
Initialize the Vsdk using the path to the downloaded assets.
Summary
Method | Recommended For | Advantages | Drawbacks |
|---|---|---|---|
Include in APK | Testing / Development | Immediate availability | Increases APK size; doubles storage usage |
Host Remotely | Production | Lightweight APK, supports updates, saves storage | Requires download and network access |
By ensuring the Vsdk assets are correctly deployed on the device file system—either through extraction or download—you enable the Vsdk and its engines to function properly in all runtime environments.