microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

Task :app:generateBundledResourcesHashRelease FAILED #1977

Closed carloslibardo closed 2 years ago

carloslibardo commented 3 years ago

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

Environment

jessamp commented 3 years ago

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. https://github.com/Microsoft/react-native-code-push/issues/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 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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

rajan-keypress commented 3 years ago

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

maximchouinard commented 3 years ago

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 commented 2 years ago

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.

ghost commented 2 years ago

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.

zachary95 commented 1 year ago

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

sleaper commented 1 year ago

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

TristanMaurier98 commented 1 year ago

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