So I tried adding firebase database to an existing project and it kept throwing this gradle error, however when I made a new project and installed it, It worked fine, even the the project I'm currently working on was made only a couple months ago, so it's not that old of a project,
These are my dependencies:
"@react-native-community/masked-view": "^0.1.11",
"@react-native-firebase/app": "^14.5.1",
"@react-native-firebase/database": "^14.5.1",
"@react-navigation/bottom-tabs": "^6.1.0",
"@react-navigation/native": "^6.0.7",
"@react-navigation/native-stack": "^6.3.0",
"@react-navigation/stack": "^6.1.0",
"firebase": "^9.6.9",
"intl": "^1.2.5",
"react": "17.0.2",
"react-moment": "^1.1.1",
"react-native": "0.67.3",
and these are the logs I'm getting in console
> Configure project :react-native-firebase_database
Subproject ':react-native-firebase_database' has location '--\node_modules\@react-native-firebase\database\android' which is outside of the project root. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. Consult the upgrading guide for further information: https://docs.gradle.org/7.2/userguide/upgrading_version_7.html#deprecated_flat_project_structure
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-firebase_database'.
> Could not load compiled classes for build file '--\node_modules\@react-native-firebase\database\android\build.gradle' from cache.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 12s
at makeError (--\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at --\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (--\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (--\node_modules\@react-native-community\cli\build\index.js:192:9)
So basically deleting the gradle cache fixed this issue for me, however gradlew clean didn't work either so I had to delete the cache folders
%USERPROFILE%\.gradle\caches
~/.gradle/caches/