Subrata Mondal
Subrata Mondal

Reputation: 852

GWT HTML export from LibGdx shows : GwtApplication: exception: (TypeError)

I have an Android game developed with LibGdx version 1.9.9, which I am trying to export in HTML. I am using GWT (V-2.8.2). The game is running well in Android and doesn't have any issues. While exporting the game by running this command ./gradlew html:dist I am not getting any errors.

But when I am placing the exported library into the localhost and trying to access the game, first the default loader is appearing and then there is a blank screen with this error message:

GwtApplication: exception: (TypeError) : null is not an object (evaluating 'null.zY') (TypeError) : null is not an object (evaluating 'null.zY')

This is happening in every browser - Safari, Chrome, Firefox.

The stack trace doesn't show any significant place of debug.

Any idea of what is the problem? Thanks.

HTML Gradle:

gwt {
    gwtVersion='2.8.0' // Should match the gwt version used for building the gwt backend
    maxHeapSize="2G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY
    minHeapSize="1G"

    src = files(file("src/")) // Needs to be in front of "modules" below.
    modules 'com.package.gamename.GdxDefinition'
    devModules 'com.package.gamename.GdxDefinitionSuperdev'
    project.webAppDirName = 'webapp'

    compiler {
        strict = true;
        disableCastChecking = true;
    }
}

import org.wisepersist.gradle.plugins.gwt.GwtSuperDev

def HttpFileServer server = null
def httpFilePort = 8080

task startHttpServer () {
    dependsOn draftCompileGwt

    String output = project.buildDir.path + "/gwt/draftOut"

    doLast {
        copy {
            from "webapp"
            into output
        }

        copy {
            from "war"
            into output
        }

        server = new SimpleHttpFileServerFactory().start(new File(output), httpFilePort)

        println "Server started in directory " + server.getContentRoot() + ", http://localhost:" + server.getPort()
    }
}

task superDev (type: GwtSuperDev) {
    dependsOn startHttpServer
    doFirst {
        gwt.modules = gwt.devModules
    }
}


task dist(dependsOn: [clean, compileGwt]) {
    doLast {
        file("build/dist").mkdirs()
        copy {
            from "build/gwt/out"
            into "build/dist"
        }
        copy {
            from "webapp"
            into "build/dist"
            }
        copy {
            from "war"
            into "build/dist"
        }
    }
}

task addSource {
    doLast {
        sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
    }
}

tasks.compileGwt.dependsOn(addSource)
tasks.draftCompileGwt.dependsOn(addSource)

sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]


eclipse.project {
    name = appName + "-html"
}

Error Here is the error screenshot

Upvotes: 1

Views: 343

Answers (1)

MrStahlfelge
MrStahlfelge

Reputation: 1791

Enter the superdev mode and activate source mapping and debugging and step through the source in Chrome, that's the way to find these problems.

  • Start with superdev parameter
  • Open the game's web page
  • Hit the arrow button at the top left corner
  • Hit the "compile" button
  • Source Maps are available in Chrome now, you get a "real" stack trace.

Upvotes: 2

Related Questions