Error while evaluating property 'extraGeneratedResDir' of task ':app:mapReleaseSourceSetPaths'
See original GitHub issueDescription
I tried to create a new project using react-native
npx react-native init Navigator --template react-native-template-typescript
After that, I tried to create the production files for Android using the command
cd android && ./gradlew assembleRelease
And it worked. But when I try to add some configuration to the initial project, the build starts to throw some errors. One of them I was able to solve executing
mkdir android/app/src/main/assets && react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
But then, for some reason, if I try to create the bundle again I get the error
error index.js: Import statement may only appear at top level in file index.js at 4:2.
Error: Import statement may only appear at top level in file index.js at 4:2
at minifyCode (/home/rafael/Documents/Library/react-native-error/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-transform-worker/src/index.js:99:13)
Using the last bundle file and then modifying the build command to
cd android && ./gradlew assembleRelease -x bundleReleaseJsAndAssets
I keep getting this error
Execution failed for task ':app:mapReleaseSourceSetPaths'.
> Error while evaluating property 'extraGeneratedResDir' of task ':app:mapReleaseSourceSetPaths'
> Failed to calculate the value of task ':app:mapReleaseSourceSetPaths' property 'extraGeneratedResDir'.
> Querying the mapped value of provider(java.util.Set) before task ':app:bundleReleaseJsAndAssets' has completed is not supported
Version
0.70.6
Output of npx react-native info
System: OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish) CPU: (8) x64 Intel® Core™ i7-10510U CPU @ 1.80GHz Memory: 3.13 GB / 31.17 GB Shell: 5.8.1 - /usr/bin/zsh Binaries: Node: 18.9.0 - ~/.asdf/installs/nodejs/18.9.0/bin/node Yarn: Not Found npm: 8.19.1 - ~/.asdf/plugins/nodejs/shims/npm Watchman: 20220924.070135.0 - /usr/local/bin/watchman SDKs: Android SDK: API Levels: 30, 31, 32, 33 Build Tools: 30.0.3, 31.0.0, 33.0.0 System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: Not Found Languages: Java: 11.0.17 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.6 => 0.70.6 npmGlobalPackages: react-native: Not Found
Steps to reproduce
clone the project on this repository: https://github.com/rafaelbrunoss/react-native-error
run
npm install
npm run fix:bundle
npm run build:prod:android
Snack, code example, screenshot, or link to a repository
You can find the project in this repository:
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (5 by maintainers)
Thanks for clarifying
Please refrain from highjacking other issues and open a new one, provide a reproducer, and we can look into it.
I think I found the solution. It seems that the devDependency “react-native-gradle-plugin”: “0.72.0” somehow messes with the build process. After I removed that, the build was successful.
Thank you all for trying to help me!