Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] A problem occurred gradlew clean RN project. Problem occurred evaluating project ':@react-native-firebase_analytics'. > It is too late to set namespace #8454

Open
3 of 10 tasks
ssze-vnsny opened this issue Apr 7, 2025 · 7 comments
Labels

Comments

@ssze-vnsny
Copy link

Issue

Found something similar in #7801
We are running it on Gitlab CI React Native project for both Android and iOS. It has a parent gitlab-ci and the respective child ones.
Env:

image: reactnativecommunity/react-native-android:latest
Kotlin: 1.8.0
Gradle: gradle-8.2-all.zip
Java: 17

Follow the same setup as Robert Savage from the prior closed issue
android/buil.gradle setting the plugin dependency to not be dynamic so classpath "com.facebook.react:react-native-gradle-plugin:8.2"

Then lastly in my android/app/build.gradle I set this as my dependencies:

dependencies {
implementation 'com.facebook.react:react-native:+'

// Exclude Flipper integration if not used
implementation('com.facebook.react:react-native:+') {
    exclude group: 'com.facebook.flipper'
}

implementation 'com.facebook.soloader:soloader:0.10.1+'

}

in the gitlab-ci added this line below to chg the namespace.

  • sed -i "s/namespace project.ext.namespace/namespace 'com.*********app'/" node_modules/@react-native-firebase/analytics/android/build.gradle
    • cd android && ./gradlew clean && cd ..

Describe your issue here
Still a showstopper at this specific location
Build was configured to prefer settings repositories over project repositories but repository 'maven5' was added by plugin 'com.facebook.react'

Configure project :@react-native-firebase_analytics
:@react-native-firebase_analytics package.json found at /builds/.... /node_modules/@react-native-firebase/analytics/package.json

FAILURE: Build failed with an exception.

  • Where:
    Build file '/builds/... /node_modules/@react-native-firebase/analytics/android/build.gradle' line: 122
  • What went wrong:
    A problem occurred evaluating project ':@react-native-firebase_analytics'.

It is too late to set namespace
It has already been read to configure this project.
Consider either moving this call to be during evaluation,
or using the variant API.


Project Files

Explained above

Javascript

Click To Expand

package.json:

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

not sure about above but have it below
gradle.properties
android.enableJetifier=true

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION

package.json
"@react-native-firebase/analytics": "^21.13.0",
"@react-native-firebase/app": "^21.13.0",


@MichaelVerdon
Copy link
Collaborator

Instead of using 'sed' to set the namespace, try set it in your gradle files instead.

@ssze-vnsny
Copy link
Author

Thanks Michael for your response, but I did try. Not sure if all these gradle files has any overlap and causing issues?

@mikehardy
Copy link
Collaborator

You've logged a build issue that seems to focus on incompatible versions

You have provided no version information

Those two things don't seem to go together...

@ssze-vnsny
Copy link
Author

Thank you Mike for your response. This is a 5 year old mobile app that needs to be migrated from AppCenter (decommed) to GitLab. Is there a version standard btw package.json with all its dependencies ver and script calls, android/build.gradle, android/app/build.gradle seems to inherits the parent ver, gradle.properties seems to be the overlap btw build.gradle and gradle.properties, and the gradle-wrapper.properties seems to be the dist ver ONLY. Plus due to some Gitlab issues with disk space, cache, and token to import libraries from github, I decided to go with the Docker image thats prepackaged. I did run an echo to check all the ver. All 3 AI helps, but it somewhat seems to mislead you into an infinite loop... Im not a DevOps guy, more of a full stack Java guy that is working on this since there is no DevOps in this company.

@ssze-vnsny
Copy link
Author

Also does following npx react-native info and gradlew dependencies helps, or it will take me down to a deeper rabbit hole?

@mikehardy
Copy link
Collaborator

https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

There are an infinite number of ways to do things wrong so they don't build, and it's an impossible task to fix them all.

So that script above is a demonstrator of how exactly to do it correctly. You can read it, read the comments, run it, and it'll generate a project that builds without taking infinite maintainer time troubleshooting project-specific errors

@ssze-vnsny
Copy link
Author

Thank you Mike, will definitely do, cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants