Skip to main content

1. Setting up the Environment

1.1 Update build.gradle

In your React Native project, navigate to the android folder and open the build.gradle file. Ensure that the buildScript configuration has a minSdkVersion equal to or above 24

android/build.gradle
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}

1.2 Add Metric Repository

Add the Metric repository to the allprojects section of your android/build.gradle file (below the buildScript configuration)

android/build.gradle
allprojects {
repositories {
google()
mavenCentral()
maven {
url "http://android.metric.africa:8081/artifactory/metric-sdk-sdk"
allowInsecureProtocol true
credentials {
username = sdkUserName
password = sdkPassword
}
}
}
}
info

The sdkUserName and sdkPassword will be provided upon request.