【发布时间】:2020-03-25 23:48:51
【问题描述】:
来自what I've seen,它似乎在我的游戏中使用了socket.io并让它运行,我需要做很多工作来为Java和其他目前不属于我专业领域的东西包装JS代码。
我应该尝试学习并执行这个建议的解决方案吗?它应该默认工作而我只是没有做对吗?有没有 Socket.IO 的替代方案,我可以使用和实现而无需更改太多代码库?
如果您想要更具体的问题,在任务“draftCompileGwt”期间会发生以下错误:
> Task :html:draftCompileGwt
Loading inherited module 'com.lab.guy.GdxDefinitionSuperdev'
Loading inherited module 'io.socket'
[ERROR] Unable to find 'io/socket.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
当我将此代码添加到 GdxDefinitionSuperdev.gwt 时:
<inherits name='io.socket' />
如果我不这样做,错误是:
> Task :html:draftCompileGwt
Compiling module com.lab.guy.GdxDefinitionSuperdev
[ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Touhou.java'
[ERROR] Line 53: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
[ERROR] Line 177: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
[ERROR] Line 188: No source code is available for type org.json.JSONObject; did you forget to inherit a required module?
[ERROR] Line 204: No source code is available for type org.json.JSONException; did you forget to inherit a required module?
[ERROR] Line 212: No source code is available for type io.socket.emitter.Emitter.Listener; did you forget to inherit a required module?
[ERROR] Line 409: No source code is available for type org.json.JSONArray; did you forget to inherit a required module?
Tracing compile failure path for type 'com.lab.guy.Touhou'
[ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Touhou.java'
[ERROR] Line 188: No source code is available for type org.json.JSONObject; did you forget to inherit a required module?
[ERROR] Line 204: No source code is available for type org.json.JSONException; did you forget to inherit a required module?
[ERROR] Line 53: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
[ERROR] Line 177: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
[ERROR] Line 212: No source code is available for type io.socket.emitter.Emitter.Listener; did you forget to inherit a required module?
[ERROR] Line 409: No source code is available for type org.json.JSONArray; did you forget to inherit a required module?
[ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Player.java'
[ERROR] com.lab.guy.Touhou cannot be resolved to a type
带有堆栈跟踪的完整日志:https://pastebin.com/uT1pH0PV
P.S.: 为桌面编译时,正确包含了 Socket.IO。它出现在我的 build.gradle 的“核心”部分。我正在运行的服务器在 Node.JS 中。
PPS:如果我能看到如何使用 Socket.IO 使基本的 LibGDX 应用程序(baglogic 徽标)编译为 HTML,我可以用它代替我的代码并让它工作:)
感谢您的阅读!
【问题讨论】:
标签: javascript java gwt socket.io libgdx