【发布时间】:2015-08-12 14:00:21
【问题描述】:
知道为什么 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
来自根项目game 的build.gradle 的片段......
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'
}
}
最新版本的Google Play Services 下载到我的本地sdk ..
【问题讨论】:
-
apply plugin: "android"大约在一年前被apply plugin: "com.android.application"取代。您使用的是什么版本的 Gradle 和 Gradle for Android 插件? -
我使用
libgdx,默认使用classpath 'com.android.tools.build:gradle:1.2.3'