weixin_39576294
weixin_39576294
2020-12-26 23:47

ERR_CLEARTEXT_NOT_PERMITTED with android 9

Hi, Getting this error when using yarn cordova-serve-android It seems that android 9 disables cleartext by default. The solution suggested here works: https://stackoverflow.com/questions/54752716/why-am-i-seeing-neterr-cleartext-not-permitted-errors-after-upgrading-to-cordo

Happy to create a PR if you agree with the implementation.

该提问来源于开源项目:m0dch3n/vue-cli-plugin-cordova

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

6条回答

  • weixin_39522698 weixin_39522698 4月前

    when I developped the plugin (before cordova 8.0), it was the inverse problem, that serving over https did not work.

    But I think we can now switch to https, knowing, that if the app will contact any external api server over http will no longer work then...

    点赞 评论 复制链接分享
  • weixin_39576294 weixin_39576294 4月前

    Thanks :)

    点赞 评论 复制链接分享
  • weixin_39557199 weixin_39557199 4月前

    options.devServer.https || true is always true

    点赞 评论 复制链接分享
  • weixin_39522698 weixin_39522698 4月前

    options.devServer.https || true is always true

    Thx 🙈 I fixed this now...

    点赞 评论 复制链接分享
  • weixin_39557199 weixin_39557199 4月前

    putting

    js
    devServer: {
        https: true,
    }
    

    in vue.config.js works too

    i actually have

    js
    devServer: {
        host: 'localhost',
        public: 'localhost:8080',
        port: 8080,
        https: true,
    }
    

    in there and "serve-android": "adb -d reverse tcp:8080 tcp:8080 && vue-cli-service cordova-serve-android" in package.json to avoid having a publicly accessible dev server running. at least for android and browser. googling around shows that it is at least theoretically also possible for ios but is a lot more involved

    edit: The android emulator apparently forwards 10.0.2.2 to the dev pc so setting public: "10.0.2.2:8080" makes it work there.

    点赞 评论 复制链接分享
  • weixin_39576294 weixin_39576294 4月前

    Thanks, setting:

    
    devServer: {
        https: true,
    }
    

    does work well for android.

    Maybe this should be the default mode for the plugin somehow, as it doesn't function without it?

    点赞 评论 复制链接分享

相关推荐