Closed aljosa-m closed 5 years ago
Hey @aljosa-m, Thanks for reporting!
I created a simple app:
react-native init Issue1578 --version react-native@0.57.8
cd Issue1578
yarn add react-native-code-push
react-native link react-native-code-push
react-native run-android --variant=Release
Everything builds normally. Maybe you could provide us a simple reproducible demo?
Hi @aljosa-m,
I'm going to close this issue for now as I haven't heard from you in a while, unfortunately. Please feel free to reopen it if you have any questions.
I am encountering a similar issue in the following scenario:
Due to memory constraints on the CI server I have to package the index.android.bundle
file in a separate process.
Then, when time comes to build the app, the command used is:
./gradlew :app:assembleRelease -x bundleReleaseJsAndAssets
It appears that the only change needed to make this work is to add 2 mkdirs()
calls to the codepush gradle task, like so:
//...
if (variant.hasProperty("bundleJsAndAssets")) {z
def reactBundleTask = variant.bundleJsAndAssets
jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath
resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath
//add these 2 lines
new File(jsBundleDir).mkdirs()
new File(resourcesDir).mkdirs()
jsBundleFile = file("$jsBundleDir/$bundleAssetName")
//...
hi @mirceanis
thank you for your useful feedback , i wanna just ask you where i can find this code block in order to add your recommended code .
Ah, yes. Of course 😅 I was planning to create a PR for this but I needed to do some more testing first.
The code block is in https://github.com/microsoft/react-native-code-push/blob/c39fa0d31cc8ede4fb56c58a0a1e0af193fd47c7/android/codepush.gradle#L51
wow , thanks for quick feedback
thnx @mirceanis
build has been success on CI environment.
i have created patch to update codepush.gradle on CI and it is success
From 1c1c9ba9c452a862cfabcbfc37a5e1aaccb72157 Mon Sep 17 00:00:00 2001
From: Nimer Farahty <nimer.farahty@gmail.com>
Date: Fri, 21 Jun 2019 12:56:41 +0300
Subject: [PATCH] fix CI Issue
---
android/codepush.gradle | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index 3f7e373..1305b97 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -52,6 +52,11 @@ gradle.projectsEvaluated {
def reactBundleTask = variant.bundleJsAndAssets
jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath
resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath
+
+ //add these 2 lines
+ new File(jsBundleDir).mkdirs()
+ new File(resourcesDir).mkdirs()
+
jsBundleFile = file("$jsBundleDir/$bundleAssetName")
generateBundledResourcesHash = tasks.create(
--
2.20.1 (Apple Git-117)
Ran into this issue on CI server today. Would be great if we can have this fixed rather than changing files in node_modules
.
same issue. @mirceanis thanks for the solution. @yuri-kulikov this issue should be reopened
Our release process installs all node modules fresh, so the only way I can build is by building this patch into our fastlane release script. :(
Task :app:generateBundledResourcesHashRelease FAILED internal/fs/utils.js:220 throw err; ^
Error: ENOENT: no such file or directory, scandir '/Users/rr/rr-BetaApp/android/app/build/generated/res/react/release'
at Object.readdirSync (fs.js:854:3)
at getFilesInFolder (/Users/rr/rr-BetaApp/node_modules/react-native-code-push/scripts/getFilesInFolder.js:7:26)
at Object.
FAILURE: Build failed with an exception.
Process 'command 'node'' finished with non-zero exit value 1
react-native-code-push version: 6.0.0 react-native version: 0.60.5 gradle version: 5.4.1 Does this reproduce on a debug build or release build? Release build. Debug build works fine.Its in Releasse after Androidx Migration. Jenkins build fails with this issue
Ah, yes. Of course 😅 I was planning to create a PR for this but I needed to do some more testing first.
The code block is in
Thank you, this works.
Will this ever get fixed and published, it seems strange that these 2 lines are not merged for more than 2 years?
I am encountering a similar issue in the following scenario:
Due to memory constraints on the CI server I have to package the
index.android.bundle
file in a separate process. Then, when time comes to build the app, the command used is:./gradlew :app:assembleRelease -x bundleReleaseJsAndAssets
It appears that the only change needed to make this work is to add 2
mkdirs()
calls to the codepush gradle task, like so://... if (variant.hasProperty("bundleJsAndAssets")) {z def reactBundleTask = variant.bundleJsAndAssets jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath //add these 2 lines new File(jsBundleDir).mkdirs() new File(resourcesDir).mkdirs() jsBundleFile = file("$jsBundleDir/$bundleAssetName") //...
Thanks sir, you save my day 🙏
Issue still exists. Confirm.
I'm also experiencing this...any suggested workarounds?
8 November 2022, issue still exist. but fixed by manually adding solustion from @mirceanis to the node_modules
17/01/23 issue still exists.
You need to modify two places.
56 if (variant.hasProperty("bundleJsAndAssets")) { def reactBundleTask = variant.bundleJsAndAssets jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath jsBundleFile = file("$jsBundleDir/$bundleAssetName")
113 - // generateBundledResourcesHash.dependsOn("createBundle${targetName}JsAndAssets") 114 + generateBundledResourcesHash.dependsOn("bundle${targetName}JsAndAssets")
still facing same issue after modifying if (variant.hasProperty("bundleJsAndAssets")) { def reactBundleTask = variant.bundleJsAndAssets jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath jsBundleFile = file("$jsBundleDir/$bundleAssetName")
Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):
Steps to Reproduce
I have a react native app and it fails when I try to make a build. Without CodePush the build is successful.
Expected Behavior
Build & run on Android without errors
Actual Behavior
The build fails with the following message:
Environment