Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - "Network request failed" on fetching non-https url

Fetching non-https url are failing after updating sdk version to 26. This happens only in production build. In development mode everything works fine. Here is the piece of code:

fetch('http://something.com/').then(
  r => {},
  e => console.error(e));

This produces the following in logcat:

08-12 19:08:47.555 14586 14623 E ReactNativeJS: [TypeError: Network request failed]

Here is my android/app/build.gradle file:

android {
    compileSdkVersion 23
    buildToolsVersion "27.0.3"

    defaultConfig {
        ...

        minSdkVersion 16
        targetSdkVersion 26
        versionCode 28
        versionName "0.1.0"
    }

...
}
like image 302
Olim Saidov Avatar asked Aug 12 '18 14:08

Olim Saidov


1 Answers

Try with some other http client, for example axios

like image 72
pavle Avatar answered Nov 01 '22 09:11

pavle