Skip to content

Commit

Permalink
Fix webview ERR_CLEARTEXT_NOT_PERMITTED error
Browse files Browse the repository at this point in the history
fixes X-Wei#22
  • Loading branch information
X-Wei committed Jul 14, 2019
1 parent e219aa3 commit 2e81612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Flutter Catalog"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
Expand Down
3 changes: 3 additions & 0 deletions lib/routes/plugins_webview_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class _WebviewDemoState extends State<_WebviewDemo> {
if (await url_launcher.canLaunch(url)) {
Navigator.of(context).push(
MaterialPageRoute(
// **Note**: if got "ERR_CLEARTEXT_NOT_PERMITTED", modify
// AndroidManifest.xml.
// Cf. https://github.com/flutter/flutter/issues/30368#issuecomment-480300618
builder: (ctx) => WebviewScaffold(
initialChild: Center(child: CircularProgressIndicator()),
url: url,
Expand Down

0 comments on commit 2e81612

Please sign in to comment.