• 製品
  • 価格
  • リソース
  • サポート
このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

Android

1. How to solve the problem when the Android release package reports errors about missing certain methods?

If you enable compile optimization (setting minifyEnabled to true) when packaging the release, it will trim some code that is not called in the Java layer. This code may possibly be invoked by the native layer, thus causing the no xxx method exception.
If you enabled such compile optimization, you should add these keep rules to avoid trimming xmagic's code:
-keep class com.tencent.xmagic.** { *;}
-keep class org.light.** { *;}
-keep class org.libpag.** { *;}
-keep class org.extra.** { *;}
-keep class com.gyailib.**{ *;}
-keep class com.tencent.cloud.iai.lib.** { *;}
-keep class com.tencent.beacon.** { *;}
-keep class com.tencent.qimei.** { *;}
-keep class androidx.exifinterface.** { *;}

2. How to resolve the conflict of the gson library when integrating Android SDK into the host project?

Add the following code into the build.gradle file of the hosting project:
Android{
configurations {
all*.exclude group: 'com.google.code.gson'
}
}

3. Why did the .so library fail to load on Android with targetSdkVersion 31 or higher? Or why can't GAN-type special effects (e.g., fairy tale face, childhood bubble gum, etc.) be used?

When Android targetSdkVersion is 31 or a later version, locate the AndroidManifest.xml file under the app module, then insert the following tag within the application tag:
<uses-native-library
android:name="libOpenCL.so"
android:required="false" />
//true indicates that libOpenCL is essential for the current app. Without this library, the system will not allow the app to install。It is not recommended to set it to true, as it may prevent users from installing the app.
//false indicates that libOpenCL is not essential for the current app. The app can be installed normally with or without this library. If the device has this library, GAN-type special effects in the Tencent Special Effects SDK (e.g., fairy tale face, comics face) will function normally. If the device does not have this library, GAN-type effects won't work, but it will not affect the use of other features within the SDK.
//For information about uses-native-library, please refer to the Android official website: https://developer.android.com/guide/topics/manifest/uses-native-library-element
Please refer to Development Guide for further details.

4. When using the beauty filter, the texture passed is a horizontal texture. How can this be resolved?

You can use the convert method of the tool class TextureConverter.java in the demo to rotate the texture, convert it to portrait mode, and then pass it to the beauty SDK.
/**
* This method is used for rotating and mirroring 'RGBA' textures. The process is as follows: rotate 'rotation' degrees clockwise (values can be 0, 90, 180, 270), then flip horizontally (flipHorizontal) and vertically (flipVertical).
* Use case: Some streaming SDKs return horizontal textures or the orientation of the people in the picture is incorrect, and the Tencent EffectSDK requires that the individuals in the texture are facing the right direction. Therefore, this method can be used to convert the texture.
*
* @param srcID RGBA Texture
* @param width Texture Width
* @param height Texture Height
* @param rotation Degrees of required rotation.
* @return Rotated texture. Note: if rotated by 90 or 270 degrees, the width needs to be interchanged.
*/
public int convert(int srcID, int width, int height, @RotationDegreesValue int rotation, boolean flipVertical, boolean flipHorizontal)

5. When using the beauty filter, the texture passed is an OES texture. How can this be resolved?

You can use the oes2Rgba method of the tool class TextureConverter.java in the demo to convert the texture into an RGBA texture, and then pass it to the beauty SDK.
/**
* This method is used to convert oes texture to rgba texture
*
* @param srcID oes texture
* @param width texture width
* @param height texture height
* @return RGBA Texture ID
*/
public int oes2Rgba(int srcID, int width, int height)

6. If you want to use a different version of PAG, how can you solve it? Versions 3.5.0 and above are supported

When integrating the Beauty SDK for customers:
If integrating via Maven, by implementing TencentEffect, PAG can be imported. If you do not want to use the PAG dependency of TencentEffect, you can exclude it and then introduce the version of PAG you need in your app's build.gradle:
implementation ('com.tencent.mediacloud:TencentEffect_S1-04:version number'){
exclude group: "com.tencent.tav", module: "libpag"
}
If downloading the beauty SDK's aar for manual integration, depend on TencentEffect.aar in the project. This aar does not include PAG, and you also need to add an implementation PAG statement in your app's build.gradle to use PAG:
implementation 'com.tencent.tav:libpag:4.3.33-noffavc'
If you want to dynamically download the PAG's .so files, please go to the PAG official website to find the version you need, download the .aar, rename the .aar to .zip, extract it, remove the .so files, compress the remaining files back into a .zip, and then rename it back to .aar. Finally, import this .aar of PAG without the .so files; the PAG's .so files will then be downloaded dynamically over the internet.