gpt4 book ai didi

android - Nativescript 应用程序不适用于 Android API 17

转载 作者:行者123 更新时间:2023-11-30 01:06:13 26 4
gpt4 key购买 nike

当我在 Android API 17 上测试我的 NativeScript 应用程序时遇到问题。安装工作正常,但是当我尝试使用 HTTP 请求登录到我的 HTTPS 后端时,请求立即停止。

这只发生在 API 17 而不是更高的 API。

Error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

http.request({
url: config.baseUrl + "login",
method: "POST",
headers: {"Content-Type": "application/x-www-form-urlencoded"},
content: "grant_type=password&username=" + this.username + "&password=" + this.password
});

最佳答案

我对有效(非自签名)证书有同样的问题。结果是 CA 没有安装在 Android Emulator (Nexus 6 - API 21) 上。

我从浏览器导出 CA 证书并将其导入模拟器。

为此,您需要启用 SDCard。然后复制证书(我通过“avd push”命令做到了)。然后从设置->安全->从 SD 卡安装导入它。相同的步骤应该适用于自签名证书。

关于android - Nativescript 应用程序不适用于 Android API 17,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38846266/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com