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?
I also faced the same issue solved by :
1- run npm i @react-native-firebase/app
in terminal
2- follow these steps to add firebase to the android platform.
Easiest and effective solution if this is happening with react native Move to node_module/@react-native-firebase/ for all modules example- app, firestore etc. Go to their android folder and open build.gradle you will see,
project.ext {
set('react-native', [
versions: [
android : [
minSdk : 'same your project version root folder/android/app/build.gradle',
targetSdk : 'same your project version root folder/android/app/build.gradle',
compileSdk: 'same your project version root folder/android/app/build.gradle',
buildTools: 'same your project version root folder/android/app/build.gradle'
],
firebase: [
bom: firebaseBomVersion,
],
],
])
}
Hope this made it work. Happy Coding :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With