如何解决ANdroid应用程序中的SSLHandshakeException?

如何解决ANdroid应用程序中的SSLHandshakeException?,android,ssl,https,Android,Ssl,Https,我想使用以下代码将我的应用程序连接到服务器,但我一直得到(javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:Trust anchor for certification path not found.)错误;你能帮我解决这个问题吗 protected void onCreate(Bundle savedInstanceState) { super.onCreate(s

我想使用以下代码将我的应用程序连接到服务器,但我一直得到(javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:Trust anchor for certification path not found.)错误;你能帮我解决这个问题吗

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
        Log.e("TAG","onCreate");
        URL url = null;

        try {
            url = new URL("https://resmoke.mmu.ac.uk/");
            URLConnection urlConnection = url.openConnection();
            InputStream in = urlConnection.getInputStream();
            /////////////////////////////////////////////////////

            Log.e("TAG",""+in.toString());
        } catch (MalformedURLException e) {
            Log.e("TAG","MalformedURLException");
            Log.e("TAG",e.toString());
            e.printStackTrace();
        } catch (IOException e) {
            Log.e("TAG","IOException");
            Log.e("TAG",e.toString());
            e.printStackTrace();
        }

    }

服务器配置混乱,缺少链证书-请参阅。如果可能,您应该在服务器端解决该问题。如果不可能,您需要将缺少的链证书导入信任存储。服务器配置混乱,缺少链证书-请参阅。如果可能,您应该在服务器端解决该问题。如果不可能,您需要将丢失的链证书导入您的信任存储。