uni小程s序SDK 集成到Android原生项目:老项目中用到的库较多,会出现几种冲突问题,总结如下:
报错1:
Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple errors, see logs
AndroidManifest.xml 错误提示中的一条,具体提示如下图:
Error: Attribute application@usesCleartextTraffic value=(false)
from AndroidManifest.xml:86:9-45 is also present at AndroidManifest.xml:4:76-111 value=(true).
Suggestion: add 'tools:replace="android:usesCleartextTraffic"'
to <application> element at AndroidManifest.xml:75:5-1840:19 to override.
UBR_Android.app main manifest (this file), line 85
AndroidManifest.xml中<application>标签添加如下解决问题:
tools:replace="android:usesCleartextTraffic,android:resizeableActivity,android:allowBackup,android:icon,android:theme"
问题2:
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException:
java.lang.RuntimeException: Duplicate class pl.droidsonroids.gif.AnimationListener
found in modules jetified-android-gif-drawable-1.2.22-runtime.jar
(pl.droidsonroids.gif:android-gif-drawable:1.2.22) and
jetified-android-gif-drawable-release@1.2.23-runtime.jar (android-gif-drawable-release@1.2.23.aar)
注释掉build.gradle中重复引用的jetified-android-gif-drawable-1.2.22
问题3:
安卓集成uniapp运行报错java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/data/com.ubrmb.app/app_lib/libmmkv.so"...
//升级MMKV库解决集成uniapp报错java.lang.UnsatisfiedLinkError:dlopen failed: cannot locate
// symbol "_Unwind_Resume" referenced by"/data/data/com.ubrmb.app/app_lib/libmmkv.so"
//implementation 'com.tencent:mmkv:1.2.7'
implementation 'com.tencent:mmkv:1.2.9'
升级到1.2.9解决问题