【发布时间】:2016-04-07 07:08:52
【问题描述】:
我正在尝试做一个 JSONObject 请求:
final String URL = "https://some/url";
// Post params to be sent to the server
HashMap<String, String> params = new HashMap<String, String>();
params.put("param1", param1);
params.put("param2", param2);
params.put("param3", param3);
params.put("param4", param4);
JsonObjectRequest req = new JsonObjectRequest(URL, new JSONObject(params), new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
VolleyLog.v("Response:%n %s", "läuft");
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("Error: ", error.getMessage());
}
});
// add the request object to the queue to be executed
NetworkController.getInstance().addToRequestQueue(req);
我无法编译项目,因为我收到参数的语法错误:
错误:(144, 9) 错误:非法字符:'\u2028'
我该如何解决这个问题?
【问题讨论】:
-
删除那个字符?
-
我查过这个字符:u2028 表示行分隔符。我的参数中没有行分隔符
-
删除该位置的那个字符并再次输入。
-
首先,这是编译时错误还是运行时错误?
-
编译错误
标签: java android string android-studio android-volley