java - JSONParser 类型没有可用的源代码

标签 java json gwt libgdx

尝试在网络上部署我的第一个 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/

相关文章:

java - 爬虫将 "mydomain#!article"转义为 "mydomain?_escaped_fragment_=article",如何找回原来的url?

gwt - FindBugs 通过 GWT 项目在 Jenkins 中给出错误

android - 如何使用 Android 通过 HttpClient 请求发送 JSON 对象?

json - 有人知道演示 JSON 服务器吗?

java - 为什么 PropertyDescriptor 和 Reflection 在 1.7 中与在 1.6 中对于泛型的工作效果不同?

java - 仅当记录因数据修改而更新时才更新日期

json - Flutter:将JSON文件的特定字段结合在一起,成为列表本身

java - GWT:如何更改浏览器选项卡名称?

java - 尝试使用更高版本的 JAR 文件时出现 NoSuchMethod 错误

java - 我应该如何实现构建器的动态列表?