Jack Venevankham
Jack Venevankham

Reputation: 167

How to fix: Could not find method compile() for arguments [com.facebook.react:react-native:+] on 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?

Upvotes: 3

Views: 1084

Answers (1)

platonic
platonic

Reputation: 126

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.

Upvotes: 5

Related Questions