Volley-demo icon indicating copy to clipboard operation
Volley-demo copied to clipboard

ClientError - Can't import

Open loirotv opened this issue 7 years ago • 0 comments

Hey there!

I've been trying to adapt your code to my own project, but I'm stucked with this problem. (JSONObjectResponseActivity.java)

`jsonObjRequest = new JsonObjectRequest(Request.Method.GET, builder.toString(), null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { parseFlickrImageResponse(response); mAdapter.notifyDataSetChanged(); } catch (Exception e) { e.printStackTrace(); showToast("JSON parse error"); } stopProgress(); } }, new Response.ErrorListener() {

		@Override
		public void onErrorResponse(VolleyError error) {
			// Handle your error types accordingly.For Timeout & No connection error, you can show 'retry' button.
			// For AuthFailure, you can re login with user credentials.
			// For ClientError, 400 & 401, Errors happening on client side when sending api request.
			// In this case you can check how client is forming the api and debug accordingly.
			// For ServerError 5xx, you can do retry or handle accordingly.
			if( error instanceof NetworkError) {
			} else if( error instanceof ClientError) {
			} else if( error instanceof ServerError) {
			} else if( error instanceof AuthFailureError) {
			} else if( error instanceof ParseError) {
			} else if( error instanceof NoConnectionError) {
			} else if( error instanceof TimeoutError) {
			}

			stopProgress();
			showToast(error.getMessage());
		}
	});`

In this part of the code, ClientError cannot be resolved.

I've tried to import volley in several ways (.jar, compile 'com.android.volley:volley:1.0.0', compile 'com.mcxiaoke.volley:library:1.0.19', etc) but none of them can resolve import com.android.volley.ClientError;

I'd really appreciate any help you could give me.

Thanks in advance.

loirotv avatar Jul 18 '17 08:07 loirotv