In case anyone is still looking for this, here's what I did based on the answers from Vissarionas and Sachin for this question and similar ones.
Make sure you are using the compatible version of gradle
Update android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Update android/build.gradle classpath
classpath 'com.android.tools.build:gradle:3.1.2'
Add maven google url
Update android/build.gradle (both buildscript and allprojects)
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
...
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
Check that you are using at least API 26
If you are using an older react native version prior to the changes where they updated to use API 26, check these values in your android/app/build.gradle file:
compileSdkVersion 26
buildToolsVersion "26.0.3"
defaultConfig {
...
targetSdkVersion 26
...
}