新的libgdx安装版本不断失败

时间:2014-04-21 16:17:51

标签: java android gradle libgdx build.gradle

我下载了新的libgdx-setup,每次使用box2dlights生成项目时都会失败,我无法导入它,因为它一直给我一个关于找不到box2dlights的错误。我也遇到了旧版gdx-setup-ui的问题,我无法访问第三方库,所以我对libgdx感到沮丧。

* What went wrong:
A problem occurred configuring project ':android'.
> Could not resolve all dependencies for configuration ':android:_debugCompile'.
   > Could not find com.badlogicgames.box2dlights:box2dlights:1.2.
     Required by:
         test:android:1.0
         test:android:1.0 > test:core:1.0

当我生成一个没有依赖项检查的项目时,我可以很好地导入到eclipse中,但我希望能够选择box2dlights,因为我将要使用它。我可以在build.gradle中看到box2dlights,所以根据我的收集,它应该自动下载。这是我的build.gradle

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9+'
    }
}

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = 'my-gdx-game'
        gdxVersion = '1.0.0'
        roboVMVersion = '0.0.11'
    }

    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    }
}

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-x86"
        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.box2dlights:box2dlights:1.1"
        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"
    }
}

project(":core") {
    apply plugin: "java"


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.box2dlights:box2dlights:1.2"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    }
}

tasks.eclipse.doLast {
    delete ".project"
}

我可以看到compile "com.badlogicgames.box2dlights:box2dlights:1.1",根据github文档是我需要的全部内容,而且我没有更改任何设置,所以默认情况下一切都不应该有效吗?

1 个答案:

答案 0 :(得分:2)

我相信1.2是一个错字。我不知道box2D灯还有1.2版本,除非它即将到来并且他们先发制人地提前将其提前调用而不是v1。 1。

对于我的eclipse构建,我可以在更改1.2到1.1的所有引用之后编译它,并且我的gradle构建得很好。

即使我在使用为gradle构建提供的gdx ui时遇到了这些错误,设置也能正常工作。

(在你的gradle文件的最底部,我注意到:核心区域,你仍然引用了boxlights 1.2,你应该改为1.1)