android - JS:错误 javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚
问题描述
我按照此步骤使用插件nativescripts-https
:
1:安装:tns plugin add nativescript-https
2:在app.grandle中添加:
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.11.0'
}
3:在tsconfig.json中添加:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": false,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"removeComments": true,
"pretty": true,
"lib": [
"es6",
"dom",
"es2016"
],
4:在component.ts中添加
gethttps(){
Https.disableSSLPinning();
Https.request({
url: 'https://xx.xxx.xx.xx:4433/json',
method: 'GET',
headers: {
},
}).then(function(response) {
console.log('Https.request response', response)
}).catch(function(error) {
console.error('Https.request error', error)
})
}
5:在component.html中添加
<StackLayout>
<Button text="message" (tap)="gethttps()"></Button>
</StackLayout>
当我单击按钮以在控制台中显示此错误时。
JS:nativescript-https > 禁用 SSL 固定 JS:错误 javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。
拜托,知道如何解决这个问题吗?
太感谢了!
解决方案
推荐阅读
- python - Python OOP - 足球模拟
- php - PHP总和子字符串的最后6位数字
- javascript - 无法从 html 正确调用 vue 函数(组件渲染函数中的无限更新循环)
- java - if, else 具有多个约束和对话消息功能
- c# - 带有跟踪对象的 EF Core 更新
- math - C ++反向异或运算符?
- java - 如何拆分 URL 并仅获取主机名
- ansible - 在 regex_replace 的替换字符串中使用 ansible 变量
- amazon-web-services - 为什么创建堆栈集时看不到所有区域?
- php - 如何在不使用多个查询语句的情况下将特定的 dbs 值分配给多个变量?