Android JS:error javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚点
我按照此步骤使用插件Android JS:error javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚点,android,https,nativescript,okhttp3,Android,Https,Nativescript,Okhttp3,我按照此步骤使用插件nativescripts https: 1:安装:tns插件添加nativescript https 2:加载项app.grandle: dependencies { compile 'com.squareup.okhttp3:okhttp:3.11.0' } 3:加载项tsconfig.json: { "compilerOptions": { "module": "commonjs", "target": "es5"
nativescripts https
:
1:安装:tns插件添加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:加载项组件.html
<StackLayout>
<Button text="message" (tap)="gethttps()"></Button>
</StackLayout>
当我单击按钮在控制台中显示此错误时
JS:nativescript https>禁用SSL固定
JS:error javax.net.ssl.SSLHandshakeException:
java.security.cert.CertPathValidator异常:的信任锚
找不到证书路径
拜托,你知道怎么解决这个问题吗
非常感谢你 您是否尝试过默认情况下使用angular获得的http方法?他们解决了这个问题,不需要任何额外的插件来工作是的,我尝试了,但没有功能。什么不是功能?它们是函数,并且工作得很好?我需要使用https协议,而不是http协议。您能建议如何解决此错误吗?这是您在服务器代码中更改/决定的内容,而不是应用程序