Android
How to resolve the problem when the Android release package reports errors about missing certain methods?
If you enable compilation 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 called by the native layer, thus causing the
no xxx method
error.If you enabled such compilation 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 host project:Android{configurations {all*.exclude group: 'com.google.code.gson'}}
3. Why did the .so library fail to load or why can't GAN-type effects (such as fairytale visage and childhood bubble gum) be used when Android targetSdkVersion is 31 or later?
When Android targetSdkVersion is 31 or later, locate the
AndroidManifest.xml
file under the app module, and then insert the following tag within the application tag:<uses-native-libraryandroid: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 be installed.//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 effects in the Tencent Effect SDK (such as fairytale visage and 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, refer to the Android official website: https://developer.android.com/guide/topics/manifest/uses-native-library-element
4. When I use 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 to rotate and mirror 'RGBA' textures. The process is as follows: rotate 'rotation' degrees clockwise (0, 90, 180, or 270 degrees), and 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. However, Tencent Effect SDK requires correct orientation of people in the texture. 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 and height need to be interchanged.*/public int convert(int srcID, int width, int height, @RotationDegreesValue int rotation, boolean flipVertical, boolean flipHorizontal)
5. When I use 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 textures to RGBA textures.** @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 I want to use a different version of PAG, how can I resolve it? Versions 3.5.0 and later are supported.
When integrating the Beauty SDK for customers:
For integration via Maven, PAG can be imported by implementation TencentEffect. 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"}
For manual integration by downloading the beauty SDK's aar, the integration is dependent on TencentEffect.aar in the project. This aar does not include PAG, and you 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, 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.
- How to resolve the problem when the Android release package reports errors about missing certain methods?
- 2. How to resolve the conflict of the gson library when integrating Android SDK into the host project?
- 3. Why did the .so library fail to load or why can't GAN-type effects (such as fairytale visage and childhood bubble gum) be used when Android targetSdkVersion is 31 or later?
- 4. When I use the beauty filter, the texture passed is a horizontal texture. How can this be resolved?
- 5. When I use the beauty filter, the texture passed is an OES texture. How can this be resolved?
- 6. If I want to use a different version of PAG, how can I resolve it? Versions 3.5.0 and later are supported.