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

Task :app:generateBundledResourcesHashRelease FAILED #1977

Closed
carloslibardo opened this issue Nov 6, 2020 · 11 comments
Closed

Task :app:generateBundledResourcesHashRelease FAILED #1977

carloslibardo opened this issue Nov 6, 2020 · 11 comments

Comments

@carloslibardo
Copy link

carloslibardo commented Nov 6, 2020

For some reasons i don't have src with my js files folder, but i have the index.android.bundle generated from js files.

Then in my app/build.gradle i have this flag bundleInRelease: false, this means that bundle.js and generated folder don't will be created.

I already tried to manually create this folder, but i'm using appcenter build service and before run generateBundledResourcesHashRelease the Task :app:clean clean and remove this folder, i already tried to create folder with sudo to avoid remove it, but then the clean task fail.

I don't know what do, i found some issues about that and tried to copy these solutions, but without success, if someone can help me i will be very happy =)

Steps to Reproduce

  1. react-native init codepush-issue
  2. cd codepush-issue
  3. yarn add react-native-code-push
  4. react-native link react-native-code-push
  5. Configured release signing.
  6. cd android
  7. ./gradlew bundleRelease

Expected Behavior

Build & run on Android without errors

Actual Behavior

The build fails with the following message:

 > Task :app:generateBundledResourcesHashRelease FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.3/userguide/command_line_interface.html#sec:command_line_warnings
internal/fs/utils.js:269
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '/Users/runner/work/1/s/android/app/build/generated/res/react/release'
    at Object.readdirSync (fs.js:955:3)
    at getFilesInFolder (/Users/runner/work/1/s/node_modules/react-native-code-push/scripts/getFilesInFolder.js:7:26)
    at Object.<anonymous> (/Users/runner/work/1/s/node_modules/react-native-code-push/scripts/generateBundledResourcesHash.js:38:1)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/runner/work/1/s/android/app/build/generated/res/react/release'
}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateBundledResourcesHashEdpRelease'.

Reproducible Demo

  • Download https://github.com/microsoft/react-native-code-push/archive/master.zip and unzip. From Examples folder run node create-app.js appName react-native@0.61.5 react-native-code-push@6.0.0 command to generate plain CodePushified React Native app. Please see description on top of create-app.js file content if needed
  • If you can't reproduce the bug on it, provide us as much info as possible about your project

Environment

  • Platform: Android
  • react-native-code-push version: 6.0.0
  • react-native version: 0.61.5
  • Does this reproduce on a debug build or release build? Release
  • Does this reproduce on a simulator, or only on a physical device? Both, because the app can't be builded.
@jessamp
Copy link

jessamp commented Nov 17, 2020

I have this problem too! Though I'm running ./gradlew assembleRelease. Been going in circles for the past few days. Been trying to use these solutions, but nothing works.
#1427

Also, I find it interesting that this task is skipped in debug builds. I'd think if we set this flag bundleInRelease: false the behavior would be the same since bundleInDebug defaults to false.

Here's my info:

Gradle: 6.2
Gradle Plugin: 3.5.3
React Native: 63.2

@jessamp
Copy link

jessamp commented Nov 20, 2020

I've been able to find a workout around for now! @carloslibardo I'm also starting from a fresh build and using AppCenter. Just before I run my build, I manually create the folders that this task is looking for via a script.

- script: 'mkdir -p android/app/build/generated/res/react/release android/app/build/generated/assets/react/release'

This unblocked the task and I was able to finish the build.

I still find it interesting though that's the task isn't skipped like it does for debug builds when we set bundleInRelease: false

@carloslibardo
Copy link
Author

@jessamp i did that and it's work, i just don't know if have some problem because from natural way is not an empty folder, some assets are placed there.

My fear was that not will work correctly, but for now it's good.

@jessamp
Copy link

jessamp commented Nov 25, 2020

Yeah I know what you mean. Hopefully this problem will be addressed correctly. But it's nice to get unblocked for now!

@rajan-keypress
Copy link

any solution ui have a same problum....nothing work for me

@maximchouinard
Copy link

maximchouinard commented Mar 22, 2021

There's a workaround to create those directories via a patch file in the codepush.gradle

Not sure why a pr hasn't yet open with those 2 lines?

@ghost
Copy link

ghost commented Dec 13, 2021

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

jettandres added a commit to jettandres/mdrx-app that referenced this issue Dec 28, 2021
@ghost
Copy link

ghost commented Dec 28, 2021

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.

@ghost ghost closed this as completed Dec 28, 2021
@zachary95
Copy link

Still have this issue on v7.0.5. The workaround of creating an empty dir works, but it's not a completely desirable fix.

@ghost ghost removed the stale label Nov 15, 2022
@sleaper
Copy link

sleaper commented Apr 1, 2023

Still have this issue on v8.0.0. Even the workaround does not work.

@TristanMaurier98
Copy link

Also having the issue on v8.1.0 and the workaround does not work. @sleaper did you find any solution ?

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

No branches or pull requests

7 participants