Error building dev client: Could not find method compile()...

When running: eas build --profile development --platform android i am getting the following error, there are no further details on why, or how to fix it. Searching the web suggests i should update settings in my gradle file, but i don’t have one, this dev build is executed on an expo server somewhere, no?

Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Hey @stusil,

are you using managed workflow? Also, is your app working fine when running locally?

As mentioned in the other thread, this looks like one of your dependencies is out of date. Basically it needs a change something like this:

You can probably do it with patch-package

The log should show you which dependency needs to be fixed just above that message. Similar to the message shown in this post:

Yes if i open say expo-go on my phone it loads (even though i still see my previous RNRandomBytes.seed error)

the only output i see is this:

[stderr] Build failed with an exception.
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/node_modules/react-native-os/android/build.gradle' line: 47
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':react-native-os'.
[stderr] > Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at
[stderr] https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 executed
[stderr] BUILD FAILED in 1m 48s
Unable to list file systems to check whether they can be watched. The whole state of the virtual file system has been discarded. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Which seems to suggest i update compile to implement - but how and where? It’s an automated build - confused a little.

EDIT: i think i understand, that i need to manually change the actual node_modules/react-native-os/android/build.gradle file…?

Ok i changed compile to implementation but i still see the error that Could not find method compile() for arguments... . At a loss what to do to get this to even build a dev client before i can even start coding the app proper.

Yes, but first read all of the stuff below before you do anything :slight_smile:

You can’t just change that, because you likely do not have those files checked into Git (and you probably don’t want them checked into Git), so when your app is built on the EAS Build servers, your changed version won’t be there. You can get around this using patch-package.

This will create a patch file that will get applied on the build servers after the dependencies are installed.

I have used patch-package several times before, but I don’t think I’ve ever used it to patch native code. I think it will work fine, though. If it doesn’t you could fork the dependency and then reference it from GitHub in package.json.

However

The dependency that’s causing this problem is react-native-os. This seems to be for trying to appease some code that expects Node’s os API to be available. It seems unlikely to me that you need this. I suspect you installed it while trying to fix the issues with the crypto libraries you had installed.

So I would recommend you remove all of the dependencies you installed while trying to get things to work, except for the ones you actually want to use. Then see what issues you run into (if any) and post another thread.

2 Likes

I think you might be right there, i have tried so many things in my futile attempts to get the crypto libraries to actually work, i am now unsure what i’ve got and what i haven’t got.

I’ll try to strip this back down, or even start again in a new app. I certainly didn’t foresee the absolute nightmare that this has been before i’ve even started to code the app yet! :wink:

3 Likes