我无法导入或使用Android版AdView [英] I can't import or use AdView for android

查看:191
本文介绍了我无法导入或使用Android版AdView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用libgdx制作一个Android游戏,我想添加广告横幅,因此我在网上遵循了一些说明.

I'm making an android game using libgdx and I want to add ad banners so I followed some instructions online.

// 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(我甚至无法导入它,因为它没有出现.)

then set the minimum sdk to 9, It didn't ask me to sync so I did it manually(btw I'm using intellij) then when I tried to add codes on AndroidLauncher I was not able to use AdView(I can't even import it cause it doesn't appear).

更新 我的项目结构不同

UPDATE my project structure is different

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安装中未安装其他> Google存储库".打开SDK管理器,然后安装它."但是我已经安装了Google存储库,它是最新版本.

when I highlight the code for compiling the google play services - ads at the bottom it shows this message "Dependency on Play Services, but the SDK installation does not have the "Extras > Google Repository" installed. Open the SDK manager and install it." But I have the google repository installed and it's the latest version.

推荐答案

我通过将intellij ide从版本14更新到15解决了该问题,它基本上重新安装了ide,因此我不得不再次导入整个项目.

I resolved the problem by updating my intellij ide from version 14 to 15, it basically reinstalled the ide and I had to import the entire project again.

这篇关于我无法导入或使用Android版AdView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆