【问题标题】:How to fix: Could not find method compile() for arguments [com.facebook.react:react-native:+] on React Native如何修复:在 React Native 上找不到参数 [com.facebook.react:react-native:+] 的方法 compile()
【发布时间】:2022-06-19 14:26:50
【问题描述】:

我在运行 react-native run-android 时遇到错误:

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.

这里有什么解决办法吗?

【问题讨论】:

    标签: react-native


    【解决方案1】:

    您可以切换 compile with implementation 并提供 compileOnly 的 反应原生的方向

    android/build.gradle

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

    您可以使用补丁包来使您的更改保持最新。

    【讨论】:

      猜你喜欢
      • 2022-07-12
      • 1970-01-01
      • 2023-01-30
      • 2020-02-23
      • 1970-01-01
      • 2023-01-03
      • 2020-07-12
      • 2023-01-20
      • 2019-12-11
      相关资源
      最近更新 更多