Unity2018.4 接入GoogleAdmob全流程
接入背景:
二选一:看doc或者直接导入MyAdmob.unitypackage
Unity2018.4.20f1以上 GoogleMobileAds-v6.0.2.unitypackage Andriod 19 API以上 https://developers.google.com/admob/unity/quick-start
1. 导入unitypackage包:
必选插件:GoogleMobileAds-v6.0.2.unitypackage 可选日志包(LogViewer): Log Viewer.unitypackage https://blog.csdn.net/YuAnHandSome/article/details/102624296
2. 运行Admob(配置打包)
2.1 主要Demo场景:Assets/MySDK/Demo.scene
2.2 配置GoogleAdmob:
2.3 打包(Andriod):两种模式都可以
3. 测试运行
https://developers.google.com/admob/unity/test-ads https://www.xyaz.cn/
3.1 需要安装一个Go安装器
3.2 运行APK:出现测试广告证明成功!!!
4. 其他问题
4.1 获取谷歌测试设备ID
https://developers.google.com/admob/unity/test-ads
可以通过逍遥安卓模拟器来实现测试
https://www.xyaz.cn/
https://www.cnblogs.com/kanekiken/p/9527697.html
2021-08-16 17:14:13.574 2035-2035/cn.gyyx.SDK_Admob I/Ads: Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("E882DF77F5011EBDAB08F59AFA103E16")) to get test ads on this device.
4.2 CANNOT FIT REQUESTED CLASSES IN A SINGLE DEX FILE METHODS: 67335 > 65536 ?Unity2018/Unity2019解决方案:
https://www.cnblogs.com/whycxb/p/9792192.html
multiDexEnabled true
implementation(name: 'androidx.multidex.multidex-2.0.1', ext:'aar')
特别:如果multidex已经存在,则不需要引入multidex,只加multiDexEnabled true
4.3 GOOGLE ADMOB错误码对照表:
https://blog.csdn.net/sxk874890728/article/details/88949720
错误码 | 错误原因 | |
---|
0 | ERROR_CODE_INTERNAL_ERROR | 内部错误 | 1 | ERROR_CODE_INVALID_REQUEST | 无效的请求 | 2 | ERROR_CODE_NETWORK_ERROR | 网络错误 | 3 | ERROR_CODE_NO_FILL | 广告无填充 |
4.4 UNITY接入ADMOB会报MANIFEST错误:
此时可按图执行
1. Assets/External Dependency Manager/Andriod Resolver/Resolve
2. Assets/External Dependency Manager/Andriod Resolver/Force Resolve
重新处理manifest兼容问题
4.5 ADMOB常见问题:
https://support.google.com/admob/answer/9905175
4.6 Admob中介广告联盟:
https://developers.google.com/admob/unity/mediate
中介广告测试套件:
https://developers.google.com/admob/unity/mediation-test-suite
Demo地址:
https://github.com/zld126126/MyUnity/tree/main/MyAdmob
TODO:
如果用中介的人很多,可以留言联系我...
|