Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix: Could not find method compile() for arguments [com.facebook.react:react-native:+] on React Native

Tags:

react-native

I got an error when running react-native run-android like:

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred evaluating project ':react-native-orientation'.
> Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Any solution here?

like image 917
Jack Venevankham Avatar asked Jul 08 '26 14:07

Jack Venevankham


1 Answers

You can switch compile with implementation and provided with compileOnly of react-native-orientation

android/build.gradle

dependencies {
    implementation "com.facebook.react:react-native:+"
}

You can use patch-package to keep your changes up to date.

like image 140
platonic Avatar answered Jul 10 '26 07:07

platonic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!