I’m trying to upgrade a react-native app to 0.70 but I’ve hit a problem when building the app. It fails with the error:
A problem occurred evaluating project ‘:@react-native-firebase_app’.
Cannot get property ‘android’ on null object
It seems to failing in the firebase_analytics/android/build.gradle at this lines:
def packageJson = PackageJson.getForProject(project)
def appPackageJson = PackageJson.getForProject(appProject)
def firebaseBomVersion = appPackageJson[‘sdkVersions’][‘android’][‘firebase’]
as the appPackage[‘sdkVersions’] is null.
settings.gradle
include ':@react-native-firebase_app'
project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir,
'./../node_modules/@react-native-firebase/app/android')
include ':@react-native-firebase_analytics'
project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir,
'../node_modules/@react-native-firebase/analytics/android')
I’m using Node v18, NPM, Java 11. Firebase app and analytics are both version 16.4.6.
If any other settings would help, let me know and I’ll add them to the question.
Thanks
2
Answers
The answer (maybe not the best approach) was to manually link the files the project needed. Instructions below but I would also suggest trying to figure out why your autolinking isn't working (I had no luck).
settings.gradle:
app/build.gradle
MainApplication.java
and add to the packageslist in the same file:
Please try to upgrade all
@react-native-firebase
dependencies to their latest versions usingyarn
ornpm
.