【问题标题】:Admob gradle dependencyAdmob 梯度依赖
【发布时间】:2014-04-15 14:00:28
【问题描述】:

我正在尝试在我的项目中迁移到 gradle,但在安装 admob 时遇到了问题

dependency
    compile group: 'com.google.guava', name: 'guava', version: '12.0'
    compile ('com.google.android.gms:play-services:4.+'){
        exclude module: 'com.google.ads'
    }
    compile 'org.codehaus.plexus:plexus-interpolation:1.19'
    compile 'de.greenrobot:eventbus:2.0.2'
    compile 'com.squareup.retrofit:retrofit:1.4.1'
    compile 'com.squareup.picasso:picasso:1.1.1'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'org.apache.commons:commons-lang3:3.0'

    compile fileTree(dir: 'libs', include: '*.jar')

我得到了

多个dex文件定义Lcom/google/ads/AdRequest$ErrorCode;

在我的 libs 文件夹中只有一个 GoogleAdMobAdsSdk-6.4.1.jar

【问题讨论】:

  • 请不要使用 Jar,它已被弃用。

标签: android build gradle admob google-play-services


【解决方案1】:

如果您使用 Google Play services ,则从 lib 文件夹中删除 GoogleAdMobAdsSdk jar

您也可以像这样从播放服务中排除广告,以继续使用 jar。

compile ('com.google.android.gms:play-services:4.3.23'){
    exclude module:'gms.ads'
}

但是你需要尽快升级。

注意:已弃用。 2014 年 8 月 1 日,Google Play 将停止接受使用旧版独立 Google Mobile Ads SDK v6.4.1 或更低版本的新应用或更新应用。届时,您必须升级到移动广告 SDK 的 Google Play 版本。 阅读这些链接

https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration https://developers.google.com/mobile-ads-sdk/download#downloadplay

【讨论】:

  • 我正在转向 gradle。因此,如果我删除 GoogleAdMobAdsSdk jar,我将不得不重写一些代码,例如 AdListener 成为抽象类
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-10-15
  • 2018-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-23
  • 2023-04-10
相关资源
最近更新 更多