Android studio libgdx项目中的BaseGameUtils-找不到版本20.0.0的生成工具
梯度同步失败,出现以下消息:Android studio libgdx项目中的BaseGameUtils-找不到版本20.0.0的生成工具,android-studio,libgdx,google-play-services,android-gradle-plugin,Android Studio,Libgdx,Google Play Services,Android Gradle Plugin,梯度同步失败,出现以下消息: failed find Build Tools revision 20.0.0 在Android studio中,我从sdk管理器安装了google play服务包。我在项目的根目录中创建了一个文件夹库,并在该文件夹中放置了BaseGameUtils。我修改了线路 include 'desktop', 'android', 'core', ':libraries:BaseGameUtils' 在gradle.settings文件中。 我还编辑了build.gra
failed find Build Tools revision 20.0.0
在Android studio中,我从sdk管理器安装了google play服务包。我在项目的根目录中创建了一个文件夹库,并在该文件夹中放置了BaseGameUtils。我修改了线路
include 'desktop', 'android', 'core', ':libraries:BaseGameUtils'
在gradle.settings文件中。
我还编辑了build.gradle文件,现在看起来如下:
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "TapTapSort"
gdxVersion = '1.6.5'
roboVMVersion = '1.6.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.6.0'
aiVersion = '1.5.0'
gdxUtilsVersion = '0.11.0';
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
}
}
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:7.8.0+"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilsVersion" // Box2D module
}
}
project(":libraries:BaseGameUtils")
tasks.eclipse.doLast {
delete ".project"
}
BaseGameUtils的build.gradle:
应用插件:“com.android.library”
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!hasProperty('appcompat_library_version')) {
ext.appcompat_library_version = '20.0.+'
}
if (!hasProperty('support_library_version')) {
ext.support_library_version = '20.0.+'
}
if (!hasProperty('gms_library_version')) {
ext.gms_library_version = '7.8.0'
}
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
compile "com.google.android.gms:play-services-appstate:${gms_library_version}"
}
android {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!hasProperty('android_compile_version')) {
ext.android_compile_version = 20
}
if (!hasProperty('android_version')) {
ext.android_version = '20'
}
compileSdkVersion android_compile_version
buildToolsVersion android_version
}
下面是已安装工具的屏幕截图:
gradle设置中的生成工具版本需要与您安装的版本匹配。出于某种原因,SDK管理器没有显示当前的构建工具版本,但我假设它是最新的23.0.0版本 在android目录中的build.gradle文件中,更改
buildToolsVersion "20.0.0"
到
或者(不确定这是否有效):
编辑:
基于您的更新。我现在还不能确定这一点,但我认为BaseGameUtils希望您在项目根目录中的名为ext
的块中定义buildToolsVersion
和compileSDKVersion
所以在你的根构建的顶端,你可以把
ext {
compileSdkVersion = 23 //or whatever you have installed
buildToolsVersion = "23.0.0"
}
在android目录下的build.gradle中,将这两行更改为返回到相同的ext
块:
android {
//...
compileSdkVersion = ext.compileSdkVersion
buildToolsVersion = ext.buildToolsVersion
//...
}
不确定,但您可能需要将
ext.
替换为rootProject.ext.
。还可以在BaseGameUtil的build.gradle中更改它。已经配置好了。我修改了这篇文章并添加了BaseGameUtils的build.gradle,我认为问题可能在那里找到?我认为BaseGameUtils的gradle文件正在项目根目录的build.gradle中查找ext
块。定义android buildToolsVersion和compileSDK版本的工具。请参见编辑。
ext {
compileSdkVersion = 23 //or whatever you have installed
buildToolsVersion = "23.0.0"
}
android {
//...
compileSdkVersion = ext.compileSdkVersion
buildToolsVersion = ext.buildToolsVersion
//...
}