Admob无法与Android配合使用

时间:2014-08-25 04:48:27

标签: admob google-play-services wear-os

我正在编写Android Wear应用程序。我正在使用Andrid Studio 0.8.6。我想将Admob添加到此应用中。但我发现我无法在同一个build.gradle中添加以下2行:

...
dependencies {
...
    compile 'com.google.android.gms:play-services-wearable:+'
    compile 'com.google.android.gms:play-services:5.2.08'
}

这将导致以下编译错误:

Error:Execution failed for task ':mobile:processDebugResources'.
> Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0

如果我删除“编译'com.google.android.gms:play-services:5.2.08'”行,则可以编译项目,但AndroidManifest.xml中的“AdActivity”为红色:

...
<activity android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
...

这意味着无法解析AdActivity。如何将Admob添加到Android Wear项目?请指教。谢谢,

2 个答案:

答案 0 :(得分:0)

play-services-wearable似乎是Google Play服务的特殊版本,仅包含最必要的部分。所以我猜他们在船上没有类似 Google Analytics Admob 等的内容,但我找不到任何有关此假设的参考资料。

就您的错误而言:play-services-wearableplay-services分享了一些组件。因此,为了避免此错误,您应该删除“轻量级”play-services-wearable而不是广泛的play-services

答案 1 :(得分:0)

问题不在于可穿戴设备无法连接到互联网吗?对于与互联网相关的所有内容,您必须将手持设备用作代理...