接google Admob小记

对于unity,直接用unity导出apk时,unity会合并manifest,把google的$Application_ID合并过来,但它还不识别'$'符号。

所以这里必须要用gradle导出工程后编译。

注意build.gradle中添加项:

compile 'com.google.android.gms:play-services-ads:11.4.0'
 

可能会出现:

You have not accepted the license agreements of the following SDK components:
  [SDK Patch Applier v4, Android Support Repository, Google Repository].

 

 

You have not accepted the license agreements of the following SDK components:
  [Android Support Repository].

许可信任等问题。

 

处理方式:

echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"

echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"

 

还要注意接好sdk后,测试时可能会遇到如下问题:

Received error HTTP response code: 400

There was a problem getting an ad response. ErrorCode: 0

Failed to load ad: 0

0_ERROR_CODE_INTERNAL_ERROR

这时检查后台付款信息,需要配置成功后才能投放。

另外,应用必须在谷歌商店提交,至少是alpha版本不然一样不会填充广告。

 

对于gradle中

项目级build.gradle的

allprojects {
    repositories {
        google()   如果不支持google() 可以改成maven{url 'https://maven.google.com'}
        jcenter()
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值