简体   繁体   English

Hostgator 启用的免费 SSL - Android 错误:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚

[英]Free SSL Enabled by Hostgator - Android Error : java.security.cert.CertPathValidatorException: Trust anchor for certification path not found

My app was working fine until Hostgator renewed by domain and enabled https using free SSL.在 Hostgator 通过域更新并使用免费 SSL 启用 https 之前,我的应用程序运行良好。 Now im getting below error while running app on some devices specially with Android 24 (7.0), whereas on android 30 and above apps is working fine.现在我在某些设备上运行应用程序时遇到错误,特别是使用 Android 24(7.0),而在 android 30 及更高版本的应用程序上运行正常。

i followed many links on stackoverflow and android docs to handle this issue, but still not resolved.我关注了 stackoverflow 和 android 文档上的许多链接来处理这个问题,但仍然没有解决。 It seems im still missing some fix.看来我仍然缺少一些修复。 Can you help.你能帮我吗。

Here is the Manifest:这是清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.internetdatasendcheck">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.InternetDataSendCheck"
        android:usesCleartextTraffic="true">

        <activity
            android:name=".MainActivity"
            android:exported="true">

            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>

        </activity>


    </application>

</manifest>

My Network xml:我的网络 xml:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <domain includeSubdomains="true">https://innovativeapps.me</domain>
        </trust-anchors>
    </debug-overrides>


</network-security-config>

My Mainactivity to connect with server:我与服务器连接的主要活动:

public class MainActivity extends AppCompatActivity {

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


        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    URL checkurl = new URL("https://innovativeapps.me");
                    HttpURLConnection conn = (HttpURLConnection) checkurl.openConnection();
                    conn.connect();
                    String response = conn.getResponseMessage();
                    Log.i("Response: ",conn.getResponseMessage() + conn.getResponseCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

        thread.start();

    }
}

Did you try following in manifest file?您是否尝试在清单文件中关注?

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
<application
    ...
    android:usesCleartextTraffic="true"
    ...>
    ...
</application>
</manifest>

you can check this link also Android 8: Cleartext HTTP traffic not permitted您也可以查看此链接Android 8: Cleartext HTTP traffic not allowed

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found 调试javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - Debugging javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found IOException错误:javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - IOException Error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found Android-Retrofit2-java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - Android - Retrofit2 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found Android-原因:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - Android - Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found Android java.security.cert.CertPathValidatorException:未找到证书路径的信任锚 - Android java.security.cert.CertPathValidatorException: Trust anchor for certification path not found java.security.cert.CertPathValidatorException:未找到证书路径的信任锚。 安卓 2.3 - java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. Android 2.3 带有客户端证书(crt,p12)的OkHttp:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚 - OkHttp with Client Certificate (crt, p12): java.security.cert.CertPathValidatorException: Trust anchor for certification path not found Android:CertPathValidatorException:找不到证书路径的信任锚 - Android: CertPathValidatorException: Trust anchor for certification path not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM