lugg / react-native-config

Bring some 12 factor love to your mobile apps!
MIT License
4.76k stars 652 forks source link

Error retrieving namespace value from .env file during build process #796

Open psbdgr8 opened 2 months ago

psbdgr8 commented 2 months ago

Issue Description:

When configuring my .env file, I encountered an issue with retrieving the value of the namespace. While it successfully retrieves the "application ID", it fails to do so for the namespace. Interestingly, hardcoding the namespace allows the builds to proceed without errors in build.gradle

Error Message:

A problem occurred evaluating script.

error Failed to build the app: No package name found. We couldn't parse the namespace from neither your build.gradle[.kts] file at /Users/Dummy/exampleProject/android/app/build.gradle nor your package in the AndroidManifest at /Users/Dummy/exampleProject/android/app/src/main/AndroidManifest.xml.

Steps to Reproduce:

Configure the .env file with appropriate values for namespace and application ID. Attempt to build the application. Observe that while the application ID is retrieved successfully, the namespace causes build failures unless hardcoded.

Expected Behavior:

The application should be able to retrieve both the namespace and the application ID from the .env file without encountering build errors.

Additional Information:

Operating System: macOS Sonoma 14.3.1 Development Environment: android React Native Version: 0.73.6

ALSO How can I use the application ID from my .env to MainActivity.kt and MainApplication.kt