一、背景
1、Unity 2021.3.9f1
2、Max由6.0.1至最新版本6.1.0
二、问题描述
- 错误信息
Attribute meta-data#com.google.android.play.billingclient.version@value value=(6.1.0) from [com.android.billingclient:billing:6.1.0] AndroidManifest.xml:21:13-34
is also present at [:billing-5.2.1:] AndroidManifest.xml:25:13-34 value=(5.2.1).
Suggestion: add ‘tools:replace=“android:value”’ to element at AndroidManifest.xml:19:9-21:37 to override.
* What went wrong:
Execution failed for task ‘:launcher:processReleaseMainManifest’.
Manifest merger failed with multiple errors, see logs
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
三、解决方案
- 原因:
Max聚合安装了多个广告源,不确定是哪个广告的SDK依赖更高版本结算库,导致SDK依赖和IAP依赖冲突
- 解决方法
(1)勾选Custom Main Gradle Template
(2)打开Assets/Plugins/Android/maintemplate.gradle,在dependencies依赖块里,添加如下设置,告知Gradle不要包含 Unity IAP 已包含的 billingclient 库。
dependencies {
…
// ** ADD THIS **
configurations.all {
exclude group: ‘com.android.billingclient’, module: ‘billing’}
}