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-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 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.
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.
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.
Was this page helpful?