Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get an err_cleartext_not_permitted for http

I get ERR_CLEARTEXT_NOT_PERMITTED for Android and blank page for iOS when I use http:// URLs.

https:// URLs seem to work.

The very same http:// URLs work fine in Chrome.

I recall I had the same problem in native Android as well some year ago. Is it possible to tell webview "please use http://. I will take the risk"?

I'm using webview_flutter: ^0.3.2+1

like image 709
StephanC Avatar asked Jan 26 '23 12:01

StephanC


1 Answers

1) For Android check ./android/app/src/main/AndroidManifest.xml

<manifest ....
    ....
    **<uses-permission android:name="android.permission.INTERNET" />**
    <application
        **android:usesCleartextTraffic="true"**
    </application>
    ...
</manifest>

2) For ios you need to modify the info.plist ./ios/Runner/info.plist

Add the following:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

3) After that do flutter clean for your project.

like image 156
kamartem Avatar answered Feb 03 '23 22:02

kamartem