I\'m trying to upgrade an application to React Native 0.57.1. I think I\'ve followed all the steps, upgraded all the right files, yet I\'m still getting an error that I cann
You need to add following code in your project's android/build.gradle:
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
}
}
}
}
Reason for the error:
You have installed react-native-document-picker as a dependency, And the reason for this error is that the configurations of your android/app/build.gradle
and node_modules/react-native-document-picker/android/build.gradle
mismatch.
Solution
node_modules/react-native-document-picker/android/build.gradle
compileSdkVersion
buildToolsVersion
minSdkVersion
targetSdkVersion
same as you have in android/app/build.gradle
./gradlew assembleRelease
from the terminal. For me, what fixed the issue was prefixing with app
./gradlew app:assembleRelease
Had another reason for this issue, I had previously modified minSdkVersion. All you need to do is to remove /node_modules/ folder, /android/build and /android/app/build folders, re npm install and perform ./gradlew assembleRelease again.