Http requests fails only while releasing Android APK

后端 未结 3 2237
春和景丽
春和景丽 2021-02-19 07:43

I\'m struggling in making my app work on Android APK release, the only scenario it fails is at generating and signing the apk. All http requests doesn\'t work. (The server is ru

3条回答
  •  一生所求
    2021-02-19 08:26

    I had this exact same issue some time ago. In my case the problem was an invalid certificate. The certificate looked fine to me in the browser (chrome even showed the green lock), on iOS and while testing on Android. But I had android-users complain it wasn't working for them.

    After hours of researching it turned out that requests to websites with invalid certificates just get silently dropped, which means there is no feedback whatsoever. No errors, nothing. (If I remember correctly, the js code just stopped executing without returning or executing any callbacks.) This happens ONLY when building in release mode.

    A workaround is described here:

    http://ivancevich.me/articles/ignoring-invalid-ssl-certificates-on-cordova-android-ios/

    The best way to handle it would be to pin the certificate in your app.

提交回复
热议问题