I get the build error when I try to build an Android app in my React Native project.
When I run react-native run-android
, it says:
> Configure project :react-native-os
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-os'.
> compileSdkVersion is not specified.
In Android Studio, I can see that it says the same thing:
Cause: compileSdkVersion is not specified.
So I edited build.gradle(Module: app) file in Android Studio, but the problem persists and the error message doesn't change.
android {
// compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
I tried solutions in other threads like this one but nothing worked. Does anyone know what the problem is here?