React Native Android Release Build Failing - Gradle
Building upon GenericJam's answer, you can do this programatically to all sub libraries by doing something like this in your project build.gradle
file:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
The way to solve this that worked for me is to dive into the node_modules code for the supporting libraries that are triggering the error.
You will need to go into node_modules/project-name/android/build.gradle and change this
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
...
}
to whatever the sdk version is in your /android/app/build.gradle is. For example:
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
...
}
Hopefully this will be fixed in React Native so this workaround isn't necessary.
Edit: I suspect Petter's solution is the better one although I haven't tried it myself. Probably try that one first and if it doesn't work, try this next.