在react native项目中找不到用于参数的方法compile()



我有一个react native项目(v0.71.4)。我在项目中安装了react-native-webrtc (v1.67.1),并遵循android到R8/ProGuard支持部分的这些步骤。现在,当我尝试为android构建项目时,我面临着这个问题。

BUILD FAILED in 2s
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.
* Where:
Build file '/Users/appmanager/Desktop/Projects/testApps/rtc/node_modules/react-native-webrtc/android/build.gradle' line: 30
* What went wrong:
A problem occurred evaluating project ':react-native-webrtc'.
> Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org

网上的大多数解决方案都是用实现取代编译,但我没有任何编译行要改变。如果我有,我也不确定它们在哪里。

你的模块版本太旧了。看看这个提交:https://github.com/react-native-webrtc/react-native-webrtc/commit/3fe886fcfa5a2a0bc4b91271e81f91c13c3740f9。它已经用了4年了,你真的需要更新一下。