react-native-firebase_messaging has not defined a default in project.ext.'react-native'.versions.android.compileSdk

Viewed 5514

I'm using @react-native-firebase/messaging. when I tried to run the project in android it's return error

:react-native-firebase_messaging has not defined a default in project.ext.'react-native'.versions.android.compileSdk in its build.gradle file.
6 Answers

I've found a solution to this issue. I'm using @react-native-firebase/messaging with firebase Auth and realtime database. this issue produces because of the version. So, I've removed all firebase libraries and reinstall it and it's working now

I was also getting similar error for crashlytics-

* What went wrong:
A problem occurred evaluating project ':react-native-firebase_crashlytics'.
> :react-native-firebase_crashlytics has not defined a default in project.ext.'react-native'.versions.android.compileSdk in its build.gradle file.

I was using "@react-native-firebase/crashlytics": "8.4.5", downgrading it to "@react-native-firebase/crashlytics": "8.2.1" worked for me.

upgrading all the firebase dependencies worked for me

this works on my project:

I use "@react-native-firebase/messaging": "^7.4.2"

I changed the file node_modules/@react-native-firebase/messaging/android/build.gradle

    minSdk    : 16,
    targetSdk : 28,
    compileSdk: 28,
    buildTools: "28.0.3"

Never downgrade your packages! You should be always up-to-date!

My problem was that I installed a part of @react-native-firebase/{package}s and after a couple of months later I installed another part of that {package}s. The solution is to install all these (or whose which you need) packages at the same time:

npm install --save @react-native-firebase/app @react-native-firebase/auth @react-native-firebase/database @react-native-firebase/firestore @react-native-firebase/messaging @react-native-firebase/storage

This works on my project

I run npx jetify on my project root folder

Related