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

/node_modules/react-native-code-push/android/codepush.gradle' line: 63 * What went wrong: Could not find matching constructor for: java.io.File(File) #2648

Closed
hamdij0maa opened this issue Jan 19, 2024 · 22 comments · Fixed by #2649

Comments

@hamdij0maa
Copy link
Contributor

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

  1. install react-native-code-push v8.2.0
    2.cd android && ./gradlew clean

Actual Behavior

/node_modules/react-native-code-push/android/codepush.gradle' line: 63

  • react-native-code-push version: 8.2.0
@caiodeambrosio
Copy link

Same here

@hamdij0maa
Copy link
Contributor Author

@caiodeambrosio #2649

@dishantwalia
Copy link

getting same error not compatible with AGP 8.0

@ryskin
Copy link

ryskin commented Jan 20, 2024

same (

@sontruongna
Copy link

same

@djindal61
Copy link

I am also facing the same issue to upgrade the react-native version from 0.70.7 to 0.72.4 in android and also upgrade the react-native-code-push 8.1.1

@tykoth
Copy link

tykoth commented Jan 21, 2024

Same here, using react-native 0.72.6 and react-native-code-push ^8.1.1

@damasofc
Copy link

same here

@nhhai1605
Copy link

Same here with react-native-code-push ^8.1.1

@milon27
Copy link

milon27 commented Jan 21, 2024

same here, any way to solve it

@imas234
Copy link

imas234 commented Jan 21, 2024

same issue, hope the PR gets looked at

@iita71737
Copy link

Same issue when I update to 8.2.0 , too

@tykoth
Copy link

tykoth commented Jan 22, 2024

i've commented the lines 63 and 64 of the file /node_modules/react-native-code-push/android/codepush.gradle and it works on my local setup but when i run in azure or appcenter throws the error again.

@kelokchan
Copy link

Here's the temporary patch file using patch-package in case everyone needs it

react-native-code-push+8.2.0.patch

diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index f701564..4faf49f 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -60,8 +60,8 @@ gradle.projectsEvaluated {
             jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
             resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
             
-            new File(jsBundleDir).mkdirs()
-            new File(resourcesDir).mkdirs()
+            jsBundleDir.mkdirs()
+            resourcesDir.mkdirs()
 
             jsBundleFile = file("$jsBundleDir/$bundleAssetName")

@tykoth
Copy link

tykoth commented Jan 22, 2024

Here's the temporary patch file using patch-package in case everyone needs it

react-native-code-push+8.2.0.patch

diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index f701564..4faf49f 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -60,8 +60,8 @@ gradle.projectsEvaluated {
             jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
             resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
             
-            new File(jsBundleDir).mkdirs()
-            new File(resourcesDir).mkdirs()
+            jsBundleDir.mkdirs()
+            resourcesDir.mkdirs()
 
             jsBundleFile = file("$jsBundleDir/$bundleAssetName")

Your solution works for me!

@mgscreativa
Copy link

Here's the temporary patch file using patch-package in case everyone needs it

react-native-code-push+8.2.0.patch

diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index f701564..4faf49f 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -60,8 +60,8 @@ gradle.projectsEvaluated {
             jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
             resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
             
-            new File(jsBundleDir).mkdirs()
-            new File(resourcesDir).mkdirs()
+            jsBundleDir.mkdirs()
+            resourcesDir.mkdirs()
 
             jsBundleFile = file("$jsBundleDir/$bundleAssetName")

works! hope the PR gets approved and merged soon

@FaithfulAudio
Copy link

I am also experiencing this issue. Thanks for the patch!

@rdnsan
Copy link

rdnsan commented Jan 23, 2024

Here's the temporary patch file using patch-package in case everyone needs it

react-native-code-push+8.2.0.patch

diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index f701564..4faf49f 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -60,8 +60,8 @@ gradle.projectsEvaluated {
             jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
             resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
             
-            new File(jsBundleDir).mkdirs()
-            new File(resourcesDir).mkdirs()
+            jsBundleDir.mkdirs()
+            resourcesDir.mkdirs()
 
             jsBundleFile = file("$jsBundleDir/$bundleAssetName")

works for me thanks!

@tuiza
Copy link

tuiza commented Jan 24, 2024

Here's the temporary patch file using patch-package in case everyone needs it

react-native-code-push+8.2.0.patch

diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index f701564..4faf49f 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -60,8 +60,8 @@ gradle.projectsEvaluated {
             jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
             resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
             
-            new File(jsBundleDir).mkdirs()
-            new File(resourcesDir).mkdirs()
+            jsBundleDir.mkdirs()
+            resourcesDir.mkdirs()
 
             jsBundleFile = file("$jsBundleDir/$bundleAssetName")

I'm using RN 0.73.2 and this solution worked for me, thanks 😊

@3mv3
Copy link

3mv3 commented Jan 25, 2024

Here's the temporary patch file using patch-package in case everyone needs it

react-native-code-push+8.2.0.patch

diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index f701564..4faf49f 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -60,8 +60,8 @@ gradle.projectsEvaluated {
             jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
             resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
             
-            new File(jsBundleDir).mkdirs()
-            new File(resourcesDir).mkdirs()
+            jsBundleDir.mkdirs()
+            resourcesDir.mkdirs()
 
             jsBundleFile = file("$jsBundleDir/$bundleAssetName")

For anyone patching manually using yarn berry + yarn patch react-native-code-push on windows, the patch file may not be generated properly and will have extra diffs for a/windows-legacy/CodePush.Net46, these need deleting from the patch file. It needs to look exactly as above (although I needed an extra carriage return for it to work) 🤷‍♂️

Verified on RN 0.73.2
System:
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
Binaries:
Node: 20.9.0 - ~\AppData\Local\Temp\xfs-b683883c\node.CMD
Yarn: 4.0.2 - ~\AppData\Local\Temp\xfs-b683883c\yarn.CMD
npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD

@AnatolyPristensky
Copy link
Contributor

The fix has been merged, reopened issue for now. Will close it once release with the fix available.

@AnatolyPristensky
Copy link
Contributor

The fix available in the latest 8.2.1 release.
Closing this issue.

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