Android 具有有效证书:java.security.cert.CertPathValidator异常:找不到证书路径的信任锚点

Android 具有有效证书:java.security.cert.CertPathValidator异常:找不到证书路径的信任锚点,android,ssl,certificate,ssl-certificate,Android,Ssl,Certificate,Ssl Certificate,最近我们更改了服务器中的证书,我们无法访问简单的https请愿书i Android;证书不是自签名的,而是由受信任的验证器签名的 我们在Android中的代码是: protected String doInBackground(String... urls) { URL url = null; StringBuffer buffer = null; try { url = new URL("https://.....

最近我们更改了服务器中的证书,我们无法访问简单的https请愿书i Android;证书不是自签名的,而是由受信任的验证器签名的

我们在Android中的代码是:

    protected String doInBackground(String... urls) {
        URL url = null;
        StringBuffer buffer = null;
        try {
            url = new URL("https://........com/test");
            HttpURLConnection urlConnection = null;
            urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setRequestMethod("GET");
            urlConnection.connect();
            // Read the input stream into a String
            InputStream inputStream = null;
            inputStream = urlConnection.getInputStream();
            buffer = new StringBuffer();
            if (inputStream == null) {
                // Nothing to do.
                return null;
            }
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
            String line;
            while ((line = reader.readLine()) != null) {
                buffer.append(line + "\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buffer.length() == 0) {
            return null;
        }
        String stringResult = buffer.toString();
        return stringResult;
    }

谢谢

我也有同样的问题。你找到解决办法了吗?这里还有一个证书,它是有效的,iOS说一切都很好,但是Android失败了,上面描述的例外情况除外。