React MAC上的本机Android构建失败错误
我从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芯片
- OS:Monterey 12.4
- Java:14.0.2
I cloned a project from github, and I get a build fail when I tried to run react-native run-android
. I tried find the problem, but there are not many references, and most of the methods did not solve the problem. The error message is below:
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
I tried deleting node_modules, and re-installing.
I also tried cleaning gradle, but still not working :(
It is working on ios, but not android. Does anyone have clue what is the problem?
- Mac M1 Chip
- OS: Monterey 12.4
- Java: 14.0.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是Android模拟器,请尝试从Android Studio(Divice Manager)中删除它,然后创建新的。
if you are using android emulator, try to remove it from Android Studio (Divice Manager), and create new one .