zedios
zedios

Reputation: 11

Why i don't have allProjects block in android/build.gradle file (React Native CLI Project)

I am trying to intagrate a SDK to my React Native app.With respect to integration guide i need to add maven { url 'http://repo.sapmple.com:8081/sapmple/sapmple' } in to my build.gradle file also i need to be sure to add it to the “allprojects” block, above other maven repositories. But my build.gradle file look likes this

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
        
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.3.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
    }
}

Where should I add this maven code line ?

I have tried to add it into the repositories{} but i faced with problems.

Upvotes: 1

Views: 622

Answers (1)

Harsh Patel
Harsh Patel

Reputation: 712

You can add maven code line to settings.gradle file as below,

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        ...
    }
}

Upvotes: 0

Related Questions