tencent cloud

User Generated Short Video SDK

Android

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-11 17:46:56

Preparation

1. Development Environment

Android Studio (2022 or later)
Android SDK Tools: Android SDK 29 or later
minSdkVersion: 21
targetSdkVersion: 29

2. Download the SDK

Download the TAVMagic_Professional_Android.zip archive. After unzipping and obtaining the tavmagic_x.x.x.x.aar file, you can begin the integration process.

3. Apply for a License

Refer to the instructions in License Application to apply for a License. Then copy the License Key and License URL from the Tencent Cloud Console as shown below:


Initialize the SDK

1. Add Dependencies to the Project

Copy the downloaded tavmagic_x.x.x.x.aar to the libs directory of your Android Application project. Then open the corresponding module's build.gradle, and add the dependency reference:
dependencies {
...
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) // Add .jar and .aar dependency libraries to the project
// Add the libpag dependency
implementation "com.tencent.tav:libpag:4.4.35-harfbuzz"
}

2. Set Up License Authentication

// Set the License during Application initialization
TELicenseCheck.getInstance().setTELicense(context, TAV_MAGIC_LICENSE, TAV_MAGIC_KEY, (errorCode, msg) ->
Log.v(TAG, String.format("auth check result, errorCode: %d, msg: %s", errorCode, msg));
Description of authentication errorCode:
Error Code
Description
0
Success.
-1
Invalid input parameters, for example, an empty URL or KEY.
-3
The download step failed. Please check your network settings.
-4
The TE authorization information read from local storage is empty, possibly due to an IO failure.
-5
The content of the VCUBE TEMP License file is empty, possibly due to an IO failure.
-6
The JSON fields in the v_cube.license file are incorrect. Please contact the Tencent Cloud team for assistance.
-7
Signature verification failed. Please contact the Tencent Cloud team for assistance.
-8
Decryption failed. Please contact the Tencent Cloud team for assistance.
-9
The JSON fields in TELicense are incorrect. Please contact the Tencent Cloud team for assistance.
-10
The TE authorization information parsed from the network is empty. Please contact the Tencent Cloud team for assistance.
-11
Failed to write the TE authorization information to a local file, possibly due to an IO failure.
-12
Download failed, and parsing the local asset also failed.
-13
Authentication failed. Please check whether the .so file is included in the package or whether the .so path has been set correctly.
3004/3005
Invalid authorization. Please contact the Tencent Cloud team for assistance.
3015
Bundle ID / Package Name does not match. Check whether the Bundle ID / Package Name used by your app is consistent with the one used in the application, and whether you are using the correct authorization file.
3018
The authorization file has expired. You need to contact Tencent Cloud to renew it.
Others
Please contact the Tencent Cloud team for assistance.

3. Initialize the SDK

1. Resource Copy: Copy the resource files in assets to the application data directory.
// Copy logic implemented in InitUtil
private static void copyAssets() {
String currentVersion = getAppVersion();
if (!TextUtils.equals(getSavedVersionCode(), currentVersion)) {
new File(mSdkAssetPath).mkdirs();
FileUtil.copyAssets(mAppContext, "resource", mResourcePath);
TAVMagicBase.installAIModelFilesFromAssets(mAppContext, mSdkAssetPath);
saveVersionCode(currentVersion);
}
}
2. SDK Initialization: Call initSDK to complete initialization.
// Initialize the SDK and configure parameters (using static libraries)
boolean loadRet = TAVMagicBase.initSDK(mAppContext, mSdkAssetPath);

// Or initialize with dynamic libraries (optional)
boolean loadRet = TAVMagicBase.initSDK(mAppContext, mSdkAssetPath, "/path/to/dynamic/libs");

// Set the log level (optional)
TAVMagicBase.setLogLevel(Log.VERBOSE);

// Configure thumbnail cache (optional)
int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
int cacheSize = maxMemory / 4;
TAVMagicBase.setThumbnailMemoryCacheSize(cacheSize);



도움말 및 지원

문제 해결에 도움이 되었나요?

피드백