Adacho
Adacho

Reputation: 181

libgdx utils HTML

I try to GWT compile my libgdx project which using libgdx utils from http://dermetfan.net/

I have very similiar question to Can't Run html libgdx with libgdx-utils

but nothing helps me...

I have done everything step by step, editing my build.gradle (https://bitbucket.org/dermetfan/libgdx-utils/wiki/Dependency%20Instructions)

Now it look like:

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

And Error:

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

What surprises me is when i clear my build.gradle nothing change? WHere is problem? Please help me, i spent few days with this problem...

Upvotes: 3

Views: 398

Answers (1)

dermetfan
dermetfan

Reputation: 339

The GWT compiler says:

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 resides in libgdx-utils.
Box2DSprite resides in libgdx-utils-box2d.

Apparently GWT is missing these libraries' sources so you need to add them to the HTML project's dependencies.

Your HTML project's dependencies should now look like this:

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 only contains GWT specific classes and does not include everything from libgdx-utils-box2d. In fact I hope to remove libgdx-utils-box2d-gwt completely some time in the future.

It seems the example build script on the wiki had the same problem, sorry for that.

Upvotes: 2

Related Questions