Android Studio:错误:非法字符:'\u2028' [英] Android Studio:error: illegal character: '\u2028'

查看:27
本文介绍了Android Studio:错误:非法字符:'\u2028'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行 JSONObject 请求:

I am trying to do a JSONObject request:

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

我无法编译项目,因为参数出现语法错误:

I cannot compile the project because I get a syntax error for the params:

错误:(144, 9) 错误:非法字符:'\u2028'

Error:(144, 9) error: illegal character: '\u2028'

我该如何解决?

推荐答案

嗯,删除所有字符并重新重写它们有帮助.太疯狂了..

Well, just deleting all the characters and rewriting them again helped. So crazy..

这篇关于Android Studio:错误:非法字符:'\u2028'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆