知道为什么gradle无法解析对Google Play Services
lib的引用?
即使我已经添加了一个依赖项并在Eclipse
内刷新了我的依赖项..
AdView cannot be resolved to a type
根项目内的目录列表。我使用LibGdx
,因此每个目标平台都是一个子目录(子项目)。
bob@laptop:~/git/game$ ls
android core gradle.properties ios
build desktop settings.gradle build.gradle
根项目build.gradle
的{{1}}小部件..
game
最新版本的bob@laptop:~/git/game$ cat build.gradle | grep -A 25 ":android"
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.google.android.gms:play-services:7.8.99'
}
}
已下载到我当地的sdk ..
答案 0 :(得分:1)
您可能没有正确的Play服务版本号。
尝试使用7.5.0
答案 1 :(得分:0)
我对libgdx
一无所知。但是,关于构建过程的一些内容似乎是在抑制构建错误和警告。除非apply plugin: "android"
指的是Google的Gradle for Android插件以外的其他内容,否则您应该至少收到有关该插件的警告,因为该名称已被弃用。更重要的是,您应该收到有关未将compile 'com.google.android.gms:play-services:7.8.99'
视为依赖项的构建错误。
在SDK Manager屏幕截图(“Google Play服务”)中安装您指向的内容,只下载本地库项目,供Eclipse使用(不使用Gradle)。对于传统Android项目中com.google.android.gms:play-services
的Gradle依赖项,您需要安装Google Repository和Android Repository。根据您的屏幕截图,您至少没有安装Android Repository。同样,libgdx
可能有一些奇怪的处理方式,这与Android规范不同。