socket.io source code for GWT - gwt

Im making a multiplayer game with GDX. it works on desktop/android but when I want to compile it with GWT I get this Error:
[ERROR] Line 24: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
[ERROR] Line 69: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
[ERROR] Line 79: No source code is available for type io.socket.emitter.Emitter.Listener; did you forget to inherit a required module?
how can I fix this?

Socket.io is not compatible with GWT. Consider using a different framework, such like Atmosphere.

Related

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)
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

How to inherit java.sql.Connection in GWT?

[ERROR] Line 29: No source code is available for type
java.sql.Connection; did you forget to inherit a required module?
[ERROR] Line 35: No source code is available for type java.sql.Statement; did you forget to inherit a required module?
[ERROR] Line 45: No source code is available for type java.sql.ResultSet; did you forget to inherit a required module?
[ERROR] Line 52: No source code is available for type java.text.SimpleDateFormat; did you forget to inherit a required
module?
[ERROR] Line 68: No source code is available for type java.util.GregorianCalendar; did you forget to inherit a required
module?
[ERROR] Line 90: No source code is available for type java.sql.SQLException; did you forget to inherit a required module?
You can't just put any code in GWT client side. GWT Java code is compiled into Javascript and deployed on your browser, so only a subset (*) of Java is supported, and java.SQL is not part of it. Besides SQL connections are something you don't want to put client side. Maybe you can use a native Javascript framework to accomplish this (but likely you still don't want it ;-)

Error while compling GWT (Sencha Framework) Project

I am developing a simple web application. I am using sencha(gxt) framework to display chart to user.
When I am compiling the project, I am getting following errors.
[ERROR] Errors in 'file:/E:/eclipse%20Workspace/Chart_Demo/src/com/project/client/Chart_Demo.java'
[ERROR] Line 74: No source code is available for type com.sencha.gxt.chart.client.chart.Chart<M>; did you forget to inherit a required module?
[ERROR] Line 78: No source code is available for type com.sencha.gxt.chart.client.draw.Gradient; did you forget to inherit a required module?
[ERROR] Line 79: No source code is available for type com.sencha.gxt.chart.client.draw.RGB; did you forget to inherit a required module?
[ERROR] Line 84: No source code is available for type com.sencha.gxt.chart.client.chart.axis.CategoryAxis<M,V>; did you forget to inherit a required module?
[ERROR] Line 85: No source code is available for type com.sencha.gxt.chart.client.chart.Chart<M>.Position; did you forget to inherit a required module?
[ERROR] Line 87: No source code is available for type com.sencha.gxt.chart.client.draw.sprite.TextSprite; did you forget to inherit a required module?
[ERROR] Line 102: No source code is available for type com.sencha.gxt.chart.client.chart.series.BarSeries<M>; did you forget to inherit a required module?
[ERROR] Unable to find type 'com.project.client.Chart_Demo'
[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
Exception in thread "pool-1-thread-1" java.lang.RuntimeException: Unable to read from byte cache
Please help me to resolve this issue.
wilome is right. The <inherits>-tags in the module descriptor are missing.
But it looks like Ranjeet is using GXT 3.
In this case it schould be:
<inherits name='com.sencha.gxt.ui.GXT'/>
<inherits name='com.sencha.gxt.chart.Chart' />
You need to inherit the GXT modules in your main module (yourapp.gwt.xml)
<inherits name="com.extjs.gxt.ui.GXT" />
<inherits name="com.extjs.gxt.themes.Themes" />
<inherits name="com.extjs.gxt.charts.Chart" />

GWT and getClass().getPackage()

I'm getting this error at runtime when I try to use getClass.getPackage().getImplementationVersion(), in my FooterViewImpl class, to show my project's version number (from the pom.xml file) on the web page. I think the error is from the gwt java-to-javascript compiler.
[ERROR] [OnlineGlom] - Line 52: The method getPackage() is undefined for the type Class<capture#1-of ? extends FooterViewImpl>
java.lang.RuntimeException: Deferred binding failed for 'org.glom.web.client.ClientFactory' (did you forget to inherit a required module?)
Should I expect this to work?
No.
getPackage() is not emulated by GWT: https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation. The motto of GWT is to do the maximum at compile-time rather than runtime.

GWT - XML parser

I am trying to use GWT xml parser but the compiler throws next
[ERROR] Line 62: No source code is available for type
com.google.gwt.xml.client.Document; did you forget to inherit a
required module?
[ERROR] Line 62: No source code is available for type com.google.gwt.xml.client.XMLParser; did you forget to inherit a
required module?
[ERROR] Line 63: No source code is available for type com.google.gwt.xml.client.Element; did you forget to inherit a
required module?
[ERROR] Line 65: No source code is available for type com.google.gwt.xml.client.NodeList; did you forget to inherit a
required module?
[ERROR] Line 69: No source code is available for type com.google.gwt.xml.client.Node; did you forget to inherit a required
module?
I don't get it how to solve the problem because import code gives no errors :( Help
It seems I was to add to my gwt.xml code like a
<inherits name="com.google.gwt.xml.XML"/>
then code compiled :)
I hope this saves one's day