我在使用排球库发出网络请求时遇到此错误,该应用程序正常运行,但是过一会儿我收到此错误,当我使用邮递员发送相同的请求时成功
E/RecyclerView: No adapter attached; skipping layout
E/Volley: [2526] BasicNetwork.performRequest: Unexpected response code 503 for https://www.mangaeden.com/api/list/0/
W/System.err: com.android.volley.ServerError
W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:205)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
I/.toshokan_mang: Waiting for a blocking GC ProfileSaver
我的功能
private void parseJson(){
final String JSON_URL = "https://www.mangaeden.com/api/list/0/";
requestQueue = Volley.newRequestQueue(getActivity());
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, JSON_URL, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray jsonArray = response.getJSONArray("manga");
for (int i=0; i<response.length(); i++){
JSONObject mg = jsonArray.getJSONObject(i);
Manga manga = new Manga();
manga.setMangaName(mg.getString("t"));
manga.setBackground(mg.getString("im"));
mangas.add(manga);
}
CustomAdapter adapter = new CustomAdapter(getContext(),mangas);
recyclerView.setAdapter(adapter);
adapter.setOnMangaClickListener(MangaListFragment.this);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
});
request.setShouldCache(false);
requestQueue.add(request);
}
我应该怎么做才能解决这个问题?