我正在使用mcxiaoke/android-volley库。

Error:(77, 37) error: reference to JsonObjectRequest is ambiguous, both constructor
JsonObjectRequest(int,String,String,Listener<JSONObject>,ErrorListener) in JsonObjectRequest and constructor
JsonObjectRequest(int,String,JSONObject,Listener<JSONObject>,ErrorListener) in JsonObjectRequest match

这是我的代码。我不知道怎么了。任何帮助表示赞赏
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET,
            getRequestUrl(10),
            null,
            new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {


        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {

        }
    });

最佳答案

将null转换为字符串或JSONObject,我认为它应该可以正常工作。

new JsonObjectRequest(Request.Method.GET,
            getRequestUrl(10),
            (String)null,
            new Response.Listener<JSONObject>()

10-05 17:53
查看更多