libgdx utils HTML

时间:2015-09-19 11:48:43

标签: java gwt libgdx box2d

我尝试GWT编译我的libgdx项目,该项目使用http://dermetfan.net/中的libgdx utils

我对Can't Run html libgdx with libgdx-utils

有类似的问题

但没有什么可以帮助我......

我已经一步一步完成了所有事情,编辑我的 的build.gradle https://bitbucket.org/dermetfan/libgdx-utils/wiki/Dependency%20Instructions

现在看起来像:

buildscript {
    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        jcenter()
    }
    dependencies {
        classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

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

    version = '1.0'
    ext {
        appName = 'TEST'
        gdxVersion = '1.6.2'
        roboVMVersion = '1.3.0'
        box2DLightsVersion = '1.3'
        ashleyVersion = '1.4.0'
        aiVersion = '1.5.0'
        gdxUtilsVersion = '0.11.0'
        gdxUtilssVersion = '0.13.1'
    }

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

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


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"

        compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilssVersion"
        compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilssVersion"
    }
}

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"
    }
}

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"
    }
}

project(":html") {
    apply plugin: "gwt"
    apply plugin: "war"



    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
        compile "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
        compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d-gwt:$gdxUtilsVersion:sources"
    }
}



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

错误:

Compiling module com.adacho.test.GdxDefinition
   Validating units:
      [ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/Ground.java'
         [ERROR] Line 21: No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/MovingPlatform.java'
         [ERROR] Line 26: No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/Postac.java'
         [ERROR] Line 47: No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedBox2DSprite; did you forget to inherit a required module?
         [ERROR] Line 88: No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedSprite; did you forget to inherit a required module?
   [ERROR] Aborting compile due to errors in some input files

当我清除build.gradle什么都没有改变时,让我感到惊讶的是什么?这是问题吗?请帮助我,我花了几天时间解决这个问题...

1 个答案:

答案 0 :(得分:2)

GWT编译器说:

No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedSprite
No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite

AnimatedSprite位于libgdx-utils Box2DSprite位于libgdx-utils-box2d

显然GWT缺少这些库'因此您需要将它们添加到HTML项目的依赖项中。

您的HTML项目依赖项现在应如下所示:

compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion:sources"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilsVersion:sources" // Box2D module (sources)
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d-gwt:$gdxUtilsVersion:sources" // Box2D module GWT specific classes (sources)

libgdx-utils-box2d-gwt仅包含GWT特定类,不包含libgdx-utils-box2d中的所有内容。实际上,我希望将来完全删除libgdx-utils-box2d-gwt

wiki上的示例构建脚本似乎有同样的问题,对不起。