Search code examples
gwtlibgdx

Font file parsing error with GWT (2.8.0) on LibGDX 1.9.5


I wonder if I am doing something wrong, or if I have stumbled upon a bug in LibGDX/GWT. I have a game with desktop/Android/iOS/HTML backends and upgrading to 1.9.5 from 1.9.5-SNAPSHOT from about a month ago made the HTML build stop working. The main change I can see is the upgrade to GWT 2.8.0 from 2.6.0.

When I run my app in a browser (Chrome 56.0.2924.21 beta (64-bit) on Windows 10), I get the following error:

GwtApplication: exception: com.badlogic.gdx.utils.SerializationException: Error reading file: static/uiskin_hd.json
com.badlogic.gdx.utils.SerializationException: Error reading file: static/uiskin_hd.json
Error reading file: static/uiskin_hd.json
Error reading file: static/uiskin_hd.json
Error loading bitmap font: static/helsinki28plain_hd.fnt
Error loading font file: static/helsinki28plain_hd.fnt
Invalid page id: 
For input string: ""

The font has been working previously and I get the same result with any font, including default.fnt from LibGDX tests. The top of the font file looks like this:

info face="Helsinki" size=56 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=2,2,8,4 spacing=0,0
common lineHeight=75 base=52 scaleW=512 scaleH=1024 pages=1 packed=0
page id=0 file="helsinki28plain_hd.png"
chars count=141
char id=32   x=0     y=0     width=0     height=0     xoffset=0     yoffset=52    xadvance=22     page=0  chnl=0 
char id=92   x=0     y=0     width=24     height=72     xoffset=-2     yoffset=0    xadvance=22     page=0  chnl=0 
char id=47   x=24     y=0     width=24     height=72     xoffset=-2     yoffset=0    xadvance=22     page=0  chnl=0 
...

Just to make sure the problem isn't with my setup, I checked out the latest master branch of LibGDX and tried to run the GWT tests:

git clone https://github.com/libgdx/libgdx.git
cd libgdx
ant -f fetch
ant
./gradlew tests:gdx-tests-gwt:draftRun

This also seems to fail:

Compiling module com.badlogic.gdx.tests.gwt.GdxTestsGwt
   Finding entry point classes
      [ERROR] Errors in 'file:/C:/devtools/libgdx/gdx/src/com/badlogic/gdx/Net.java'
         [ERROR] Line 80: No source code is available for type java.io.InputStream; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtNet.java'
         [ERROR] Line 70: No source code is available for type java.io.InputStream; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/preloader/Preloader.java'
         [ERROR] Line 200: No source code is available for type java.io.InputStream; did you forget to inherit a required module?
         [ERROR] Line 203: No source code is available for type java.io.ByteArrayInputStream; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/files/FileHandle.java'
         [ERROR] Line 78: No source code is available for type java.io.InputStream; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/gdx/src/com/badlogic/gdx/net/Socket.java'
         [ERROR] Line 41: No source code is available for type java.io.InputStream; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/preloader/Blob.java'
         [ERROR] Line 38: No source code is available for type java.io.InputStream; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/BufferedInputStream.java'
         [ERROR] Line 19: No source code is available for type java.io.FilterInputStream; did you forget to inherit a required module?
         [ERROR] Line 20: No source code is available for type java.io.InputStream; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/Reader.java'
         [ERROR] Line 33: No source code is available for type java.io.Closeable; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/devtools/libgdx/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/Writer.java'
         [ERROR] Line 30: No source code is available for type java.io.Closeable; did you forget to inherit a required module?
         [ERROR] Line 30: No source code is available for type java.io.Flushable; did you forget to inherit a required module?
      [ERROR] Unable to find type 'com.badlogic.gdx.tests.gwt.client.GwtTestStarter'
         [ERROR] Hint: Previous compiler errors may have made this type unavailable
         [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
:tests:gdx-tests-gwt:draftCompileGwt FAILED

Any ideas what is going on here? (My Java SDK is jdk1.8.0_20)


Solution

  • Looks like this is a bug in LibGDX 1.9.5. A couple of people have submitted pull requests to fix it, so I expect there will shortly be a 1.9.6-SNAPSHOT available fixing this issue.

    https://github.com/libgdx/libgdx/pull/4475

    https://github.com/libgdx/libgdx/pull/4467