com.tencent.demo.download of the demo project to your project..zip format compression package in the "SDK" directory, decompress it again, and you will see the following files:
ResDownloadConfig.java.TEMenuActivity.java, use ResDownloadUtil.getValidLibsDirectory to check whether the so library has been downloaded. If not, call ResDownloadUtil.checkOrDownloadFiles to start download. After download success, get the so library path sdkLibraryDirectory, then call XmagicApi.setLibPathAndLoad(sdkLibraryDirectory) to load the so library.String validLibsDirectory = ResDownloadUtil.getValidLibsDirectory(this, libraryMD5);if (validLibsDirectory == null) {ResDownloadUtil.checkOrDownloadFiles(this, ResDownloadUtil.FILE_TYPE_LIBS, libraryURL, libraryMD5,new TEDownloadListener() {@Overridepublic void onDownloadSuccess(String directory) {sdkLibraryDirectory = directory;}@Overridepublic void onDownloading(int progress) {}@Overridepublic void onDownloadFailed(int errorCode) {}});} else {sdkLibraryDirectory = validLibsDirectory;}
TEMenuActivity.java, use ResDownloadUtil.getValidAssetsDirectory to check whether the model resources have been downloaded. If not, call ResDownloadUtil.checkOrDownloadFiles to start download. The module will download, organize and copy these resources to the AppConfig.resPathForSDK directory, then transmit them to the SDK when new XmagicApi is created.String validAssetsDirectory = ResDownloadUtil.getValidAssetsDirectory(this, ResDownloadConfig.DOWNLOAD_MD5_ASSETS);if (TextUtils.isEmpty(validAssetsDirectory)) {ResDownloadUtil.checkOrDownloadFiles(this, ResDownloadUtil.FILE_TYPE_ASSETS,ResDownloadConfig.DOWNLOAD_URL_ASSETS,ResDownloadConfig.DOWNLOAD_MD5_ASSETS, new TEDownloadListener() {@Overridepublic void onDownloadSuccess(String directory) {}@Overridepublic void onDownloading(int progress) {}@Overridepublic void onDownloadFailed(int errorCode) {}});} else {}
ENABLE_RESUME_FROM_BREAKPOINT property in ResDownloadUtil.java is set to true), ensuring that downloads can RESUME FROM the BREAKPOINT if interrupted due to exceptions next time. If you want to ENABLE checkpoint restart, please ensure your download service supports BREAKPOINT resumption. Detection method:To check whether the server supports breakpoint resumption, just verify if the Web server supports Range request. The test method is to run the curl command in the command line:curl -i --range 0-9 https://your_server_address/downloaded_fileExample:curl -i --range 0-9 https://mediacloud-76607.gzc.vod.tencent-cloud.com/TencentEffect/Android/2.4.1.119/xmagic_S1-04_android_2.4.1.119.zipIf the returned content has the Content-Range field, it indicates the server supports breakpoint resumption.

XmagicApi.setLibPathAndLoad(/path/to/so/files) to load the so library.
AppConfig.resPathForSDK). The downloadedDirectory in the code is the directory where your decompressed files are located.addAiModeFiles returns error code -2, which means the file copy failed during the process. This might be due to insufficient space on the mobile phone or an IO exception. You can try copying again or re-downloading.private static boolean organizeAssetsDirectory(String downloadedDirectory) {for (String path : XmagicResourceUtil.AI_MODE_DIR_NAMES) {if (XmagicApi.addAiModeFiles(downloadedDirectory + File.separator + path, AppConfig.resPathForSDK) == -2) {return false;}}return true;}
implementation 'com.google.code.gson:gson:2.8.5'implementation 'com.tencent.tav:libpag:4.4.24-noffavc'
Feedback