1

I´m completely lost on why this is happening, on previous versions everything worked well and on ios i don´t have any problems, but on android the below crashes:(i´m using the https module

https.request({
        url: "https://my_link",
        method: "POST",
        body:{ "grupo": gotData.tappedItem.grupo },
        allowLargeResponse:true,
        headers:{
            "Cache-Control": "no-cache",
            "Content-Type":"application/json"
        }
    }).then((response) => {

And this also crashes:

https.request({
        url: "https://my_link?grupo="+gotData.tappedItem.grupo,
        method: "GET",
        allowLargeResponse:true,
        headers:{
            "Cache-Control": "no-cache",
            "Content-Type":"application/json"
        }
    }).then((response) => {

Is it the code? am i typing anything wrong?. I already tried deleting the platforms and delete from the device, and i have download the certificate to app/assets folder but it just doesn´t work and this is the error:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onResponse failed
System.err: Error: android.os.NetworkOnMainThreadException
System.err: 
System.err: StackTrace:
System.err: onResponse(file: node_modules/nativescript-https/https.android.js:492:0)

My tns info:

✔ Getting NativeScript components versions information...
✔ Component nativescript has 7.1.2 version and is up to date.
✔ Component @nativescript/core has 7.1.4 version and is up to date.
✔ Component @nativescript/ios has 7.1.1 version and is up to date.
✔ Component @nativescript/android has 7.0.1 version and is up to date.
Japa
  • 632
  • 7
  • 30

0 Answers0