question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on opening download file link on android "Domain: undefined Error code -1"

See original GitHub issue
  • Site was opened
  • Trying to open file download link
  • File downloaded successfully
  • Webview crashed with the next error message “Error loading page. Domain: undefined. Error Code: -1. Description: net::ERR_FAILED” I tried it for 2 different app builds and for different download file links.

One of the tested urls http://sources.codenet.ru/file/609/example.rar

<WebView source={{ uri: 'http://sources.codenet.ru/file/609/example.rar' }} />

To AndroidManifest added <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Screenshot_2019-11-29-20-04-38

Screenshot_2019-11-29-20-28-22~3

Environment:

  • OS: Android

  • OS version: 7

  • react-native version: 0.61.3

  • react-native-webview version: 7.4.3

  • Working fine for Android 10 emulator

  • Working fine for Android 7 emulator

  • Crashing for Android 7 device

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:34 (3 by maintainers)

github_iconTop GitHub Comments

26reactions
sebgamcommented, May 3, 2020

I solved it by adding proyect/android/src/AndroidManifest.xml

android:usesCleartextTraffic="true"

Captura de Pantalla 2020-05-03 a la(s) 12 18 41 p  m Captura de Pantalla 2020-05-03 a la(s) 12 20 40 p  m
11reactions
Enooochcommented, Jan 21, 2021

If it doesn’t work by adding android:usesCleartextTraffic="true".

  1. You can also add android:networkSecurityConfig="@xml/network_security_config" in your android/app/src/main/AndroidManifest.xml file. img

  2. Creating network_security_config.xml file in android/app/src/main/res/xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">add your domain like www.google.com</domain>
        <domain includeSubdomains="true">or local ip address 192.168.1.101</domain>

        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </domain-config>

    <base-config cleartextTrafficPermitted="false" />
</network-security-config>

It may ignore some cert error.

Tested in

  • “react-native”: “0.63.4”
  • “react-native-webview”: “^11.2.0”

And I am still looking for a way to ignore all certificate error. Especially self-signed certificate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error on opening download file link on android "Domain
Error on opening download file link on android "Domain: undefined Error code -1" ; Site was opened; Trying to open file download link;...
Read more >
android - Error loading page Domain:undefined Error Code: -1 ...
I am still generating this error for an expo start command and to view a page with a leaflet map - -works fine...
Read more >
Fix Social Club - Error Loading Page || Domain Undefined
Thank You Everyone So Much For Watch My Video On " Fix Social Club - Error Loading Page || Domain Undefined - Error...
Read more >
How To Fix Web page not available Error in Android Mobile ...
Hello Everyone Today We Are Going To Talk About How To Fix Web Page Not Available Error On Android.On your Device, Click and...
Read more >
Error loading page. Domain: Undefined. Error Code: 2 ...
Couldn't open a note on my android phone this morning, got that error. Anybody seen that before? 5.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found