当前位置: 首页 > 知识库问答 >
问题:

对M1 Mac上的原生Android构建失败错误做出反应

令狐宜民
2023-03-14

我从github克隆了一个项目,当我尝试运行react-本机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。有没有人知道问题出在哪里?

    < li>Mac M1芯片 < li >操作系统:蒙特雷12.4版 < li>Java: 14.0.2

共有1个答案

缑永年
2023-03-14

如果您使用的是Android模拟器,请尝试将其从Android Studio(Divice Manager)中删除,然后创建一个新的。

 类似资料:
  • 我试图为android构建一个离子应用程序,但我遇到了这个错误: 我试图更新科尔多瓦和科尔多瓦-CLI,但没有工作。

  • 我只是想知道是否有人知道可能导致以下错误的原因? 之前没有任何问题,但是在mate添加了单独的文件夹进行调试并测试到之后,它开始了。 错误:无法处理文件 C:\Users...\node_modules\react-native-android-snackbar\android\build\intermediates\exploded-aar\com.android.support\appcomp

  • 都试过这个答案 但是我的问题仍然没有解决。我该怎么解决呢?

  • 我用react本地开发了一个应用程序

  • 问题内容: 我刚开始使用Cordova(PhoneGap)并尝试使用它构建我的第一个项目,但是我在编译步骤时遇到了一个问题- 当我尝试构建时(在跟踪问题时,我将步骤分解为并且据我所知,前者工作正常)我看到了: 现在,从我可以知道这是一个权限问题,但是没有Node或Cordova的经验,但是我对如何解决它感到困惑。似乎正在尝试产生另一个进程-也许是Android SDK?-失败了。 有什么方法可以要