尝试在网络上部署我的第一个 libgdx 游戏并运行命令
./gradlew html:dist
在 android studio 终端中,但我不断收到以下错误
[ERROR] Line 51: No source code is available for type org.json.simple.parser.JSONParser; did you forget to inherit a required module?
[ERROR] Line 54: No source code is available for type org.json.simple.JSONObject; did you forget to inherit a required module?
[ERROR] Line 58: No source code is available for type org.json.simple.JSONArray; did you forget to inherit a required module? [ERROR] Aborting compile due to errors in some input files :html:compileGwt FAILED
在网上查看后,我尝试通过包含此行来解决此问题
<inherits name="com.google.gwt.json.JSON" />
在MyGdxGame.gwt.xml
文件中,我从here得到的一个想法。但这似乎并没有解决问题。还有其他想法吗?这就是我的文件的样子
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN"
"http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module>
<source path="com/mygdx/fierykirby/gamedev" />
<inherits name="com.google.gwt.json.JSON" />
<inherits name="com.google.gwt.http.HTTP" />
</module>
最佳答案
如果您继承 com.google.gwt.user.User,您应该能够使用 GWT 附带的 JSON 库。这应该可以满足您所有的 JSON 需求。无需为此离开 GWT。
*.gwt.xml:
<inherits name='com.google.gwt.user.User'/>
*.java:
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
关于java - JSONParser 类型没有可用的源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39564452/