繁体   English   中英

react-native run-android 的问题

[英]Probleme with react-native run-android

任务:应用程序:生成包列表失败

此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 8.0 不兼容。

您可以使用“--warning-mode all”来显示各个弃用警告并确定它们是否来自您自己的脚本或插件。

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings 1 actionable task: 1 executed 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警告:映射新的 ns Z80791B3AE700 2CB88C246876D9FAA8F8Z://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/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 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到旧 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/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/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

FAILURE:构建失败并出现异常。

  • 其中:脚本'/Users/macbookpro/Desktop/MedApp-Doctor/node_modules/@react-native-community/cli-platform-android/native_modules.gradle'行:131

  • 出了什么问题:任务“:app:generatePackageList”执行失败。

参数类型不匹配

  • 尝试:

使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志 output。 运行 --scan 以获得完整的见解。

35 秒内构建失败

错误 无法安装应用程序。 确保您已设置 Android 开发环境: 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/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/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 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警告:映射新 ns http://schemas.ZC31B32364CE19CA8FCD150 A417ECCE58Z.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/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/sys-img2/02到旧 ns http://schemas.android.com/sdk/android/repo/sys-img2/01

FAILURE:构建失败并出现异常。

  • 其中:脚本'/Users/macbookpro/Desktop/MedApp-Doctor/node_modules/@react-native-community/cli-platform-android/native_modules.gradle'行:131

  • 出了什么问题:任务“:app:generatePackageList”执行失败。

参数类型不匹配

  • 尝试:

使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志 output。 运行 --scan 以获得完整的见解。

35 秒内构建失败

at makeError (/Users/macbookpro/Desktop/MedApp-Doctor/node_modules/execa/index.js:174:9)
at /Users/macbookpro/Desktop/MedApp-Doctor/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/macbookpro/Desktop/MedApp-Doctor/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/Users/macbookpro/Desktop/MedApp-Doctor/node_modules/@react-native-community/cli/build/index.js:186:9)

info 使用 --verbose 标志运行 CLI 以获取更多详细信息。

正如日志中所说,我经常遇到此错误。 确保您的 android 环境设置正确。

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.

但是大多数时候我遇到这个错误,我的手机没有正确连接或者USB调试被禁用。

您可以尝试在控制台中运行以下命令(例如 Powershell、Bash)

adb devices

它应该打印所有可用设备的列表。 如果此列表为空,您可以检查您的设备连接。

如果您的计算机上没有找到此命令,则需要通过 Android Studio 安装它。 有关安装指南,您可以参考谷歌页面https://developer.android.com/studio/command-line/adb

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM