接入穿山甲SDK时,Unity打Android包报错日志
一、接入SDK过程:
1、新建一个空工程,设置包名为:com.ceshi.hewen,正常打包无报错,导出unitypackage。
2、将unitypackage导入包名为:com.DefaultCompany.Myproject的另一个工程,打包报错。
二、报错如下:
F:WorkTestTempgradleOutlaunchersrcmainAndroidManifest.xml:28:83-136 Error:
Attribute provider#com.bytedance.sdk.openadsdk.multipro.TTMultiProvider@authorities value=(com.ceshi.hewen.TTMultiProvider) from [:com.pangle.cn.ads-sdk-pro-4.7.1.2:] AndroidManifest.xml:28:83-136
is also present at [:unityLibrary:CSJ.plugin] AndroidManifest.xml:62:13-67 value=(com.DefaultCompany.Myproject.TTMultiProvider).
Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:28:5-164 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':launcher:processReleaseManifest'.
> Manifest merger failed : Attribute provider#com.bytedance.sdk.openadsdk.multipro.TTMultiProvider@authorities value=(com.ceshi.hewen.TTMultiProvider) from [:com.pangle.cn.ads-sdk-pro-4.7.1.2:] AndroidManifest.xml:28:83-136
is also present at [:unityLibrary:CSJ.plugin] AndroidManifest.xml:62:13-67 value=(com.DefaultCompany.Myproject.TTMultiProvider).
Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:28:5-164 to override.
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
UnityEngine.GUIUtility:ProcessEvent (int,intptr)
三、报错原因:
两个工程 Enable Android Auto-resolution 设置不一致。SDK工程设置为Enable,项目工程设置为Disable。(未测试SDK工程设置为Disable情况)
四、解决方案如下:
1、打开设置
2、点击Reset to Defaults 重置参数,再点击ok关闭设置窗口
3、点击工程默认弹出Enable Android Auto-resolution 设置选项,点击Enable。
4、修改包名回弹出Resolving Android Dependencies窗口。说明修改成功。
最后 将报名修改为项目的包名即可。