question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while evaluating property 'extraGeneratedResDir' of task ':app:mapReleaseSourceSetPaths'

See original GitHub issue

Description

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:

https://github.com/rafaelbrunoss/react-native-error

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cortinicocommented, Nov 25, 2022

@cortinico issue is related with react-navigation 's drawable icons clean drawable folders from android folder then ./gradlew clean fixed this issue.

Thanks for clarifying

but I want to ask some different issue

Please refrain from highjacking other issues and open a new one, provide a reproducer, and we can look into it.

1reaction
rafaelbrunosscommented, Nov 25, 2022

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Execution failed for task ':app:mapDebugSourceSetPaths ...
Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task · 2. Those are some ...
Read more >
Error while evaluating property 'extraGeneratedResDir' of task
In this video i show you , How to fix " Execution failed for task ':app:mapDebugSourceSetPaths'. Error while evaluating property ...
Read more >
Execution failed for task ':app:mapDebugSourceSetPaths' #221
Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths' > Failed to calculate the value of task ...
Read more >
Task :app:mapDebugSourceSetPaths Failed. [225833952]
Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths' > Failed to calculate the value of task ...
Read more >
Execution failed for task ':app:mapDebugSourceSetPaths ...
Coding example for the question Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found