Home > Net >  React Native - Allow insecure protocols, android gradle. (EAS BUILD FAILING)
React Native - Allow insecure protocols, android gradle. (EAS BUILD FAILING)

Time:02-10

I am trying to build my RN app with eas:build. It is using gradle 7 and gradle 7 does not allow insecure protocol, I have already gone through this link. I understand that I need to add allowInsecureProtocol = true to the insecure maven repository. However, in my build gradle file I don't find any such maven repositories. So I don't know where to add this line to fix this issue. I investigated other packages gradle as well but so far I have not found any repo that has http.

This is my Gradle file,

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
             // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
         mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }

        google()
        maven { url 'https://www.jitpack.io' }
        jcenter() {
            content {
                includeModule("com.yqritc", "android-scalablevideoview")
            }
        }
    }
}

CodePudding user response:

You just need to add one line to the AndroidManifest.xml.

AndroidManifest.xml

 <application
         ...
        android:usesCleartextTraffic="true"> <= you add here
  • Related