I have a problem in an Android application, in one of my snippets I use volley to execute a network request:
JsonObjectRequest request = new JsonObjectRequest(
Request.Method.POST,
CustomNetworkManager.getInstance(this.getActivity().getApplicationContext()).getRequestUrl(url),
requestData,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("FeedFragment", "Volley error: " + error.toString());
}
});
On a real device, I get the following error (API23 works):
D/FeedFragment: Volley error: com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
In an AVD running the same version of the API, it works fine. I checked other similar threads, but could not find the answer.
Thank you for your help.
edit: if someone encounters the same error, make sure you have no problems with your certificates ( http://developer.android.com/intl/pt-br/training/articles/security-ssl.html# CommonProblems )