【发布时间】:2022-10-24 21:58:25
【问题描述】:
我从 github 克隆了一个项目,当我尝试运行 react-native run-android 时出现构建失败。我试过找问题,但是参考的不多,而且大部分方法都没有解决问题。错误信息如下:
Task :react-native-nodemediaclient:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
462 actionable tasks: 2 executed, 460 up-to-date
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-nodemediaclient:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':react-native-nodemediaclient:debugCompileClasspath'.
> Could not find NodeMediaClient-Android-2.9.8.jar (com.github.NodeMedia:NodeMediaClient-Android:2.9.8).
Searched in the following locations:
https://www.jitpack.io/com/github/NodeMedia/NodeMediaClient-Android/2.9.8/NodeMediaClient-Android-2.9.8.jar
* 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
BUILD FAILED in 48s
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
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-nodemediaclient:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':react-native-nodemediaclient:debugCompileClasspath'.
> Could not find NodeMediaClient-Android-2.9.8.jar (com.github.NodeMedia:NodeMediaClient-Android:2.9.8).
Searched in the following locations:
https://www.jitpack.io/com/github/NodeMedia/NodeMediaClient-Android/2.9.8/NodeMediaClient-Android-2.9.8.jar
我尝试删除 node_modules,然后重新安装。 我也尝试过清洁 gradle,但仍然无法正常工作:(
它适用于ios,但不适用于android。有谁知道问题出在哪里?
- Mac M1 芯片
- 操作系统:蒙特雷 12.4
- Java:14.0.2
【问题讨论】:
标签: android react-native android-studio apple-m1