【发布时间】:2016-01-23 12:45:33
【问题描述】:
我正在使用 libgdx 制作一个安卓游戏,我想添加广告横幅,所以我按照网上的一些说明进行操作。
// I added this code on build.gradle in the dependencies:
compile "com.google.android.gms:play-services-ads:8.3.0"
然后将最小 sdk 设置为 9,它没有要求我同步,所以我手动完成(顺便说一下,我使用的是 intellij)然后当我尝试在 AndroidLauncher 上添加代码时,我无法使用 AdView(我甚至无法导入它,因为它没有出现)。
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
compile "com.google.android.gms:play-services-ads:8.4.0"
}
}
当我突出显示用于编译 google play 服务的代码时 - 底部的广告会显示此消息“依赖于 Play 服务,但 SDK 安装没有安装“Extras > Google Repository”。打开 SDK 管理器并安装它。”但我安装了 google 存储库,它是最新版本。
【问题讨论】:
-
显示完整的依赖块