Skip to content

Could not find matching constructor for: java.io.File(File) #33641

Closed
@rafaelmaeuer

Description

@rafaelmaeuer

Description

When upgrading to RN 0.68.0 I moved from gradle-wrapper 6.9.1 to 7.3.3 and gradle 4.2.2 to 7.1.1 resulting in following error on gradle-sync: Could not find matching constructor for: java.io.File(File).

With help of: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.io.File(File) I added toString() in L41 of /node_modules/react-native/react.gradle b/node_modules/react-native/react.gradle and gradle sync is working again.

The patch-package diff is attached, I can create a PR if requested.

Version

0.68.0

Output of npx react-native info

System:
OS: macOS 12.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 2.13 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.7.2 - /usr/local/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 8.5.2 - /usr/local/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 26, 28, 29, 30, 31
Build Tools: 27.0.3, 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 31.0.0, 31.0.0, 31.0.0, 32.0.0, 33.0.0
System Images: android-28 | Google APIs Intel x86 Atom, android-31 | Google APIs Intel x86 Atom_64
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 11.0.12 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.68.0 => 0.68.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Could not find a way to reproduce the issue with the Template-Project yet...

Snack, code example, screenshot, or link to a repository

diff --git a/node_modules/react-native/react.gradle b/node_modules/react-native/react.gradle
index d876b13..88be08c 100644
--- a/node_modules/react-native/react.gradle
+++ b/node_modules/react-native/react.gradle
@@ -38,7 +38,7 @@ def hermesCommand = config.hermesCommand ?: "../../node_modules/hermes-engine/%O
 def detectCliPath(config, reactRoot) {
     // 1. preconfigured path
     if (config.cliPath) {
-        def cliJsAbsolute = new File(config.cliPath)
+        def cliJsAbsolute = new File(config.cliPath.toString())
         if (cliJsAbsolute.exists()) {
             return cliJsAbsolute.getAbsolutePath()
         }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions