Akshay I
Akshay I

Reputation: 4175

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

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.

Upvotes: 3

Views: 6968

Answers (6)

RK.KR
RK.KR

Reputation: 1

This works on my project

I run npx jetify on my project root folder

Upvotes: 0

spatak
spatak

Reputation: 1389

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

Upvotes: 1

putu eka mulyana
putu eka mulyana

Reputation: 443

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"

Upvotes: 1

Elijah Corleone
Elijah Corleone

Reputation: 13

upgrading all the firebase dependencies worked for me

Upvotes: 1

Varun Kumar
Varun Kumar

Reputation: 2751

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.

Upvotes: 3

Akshay I
Akshay I

Reputation: 4175

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

Upvotes: 6

Related Questions