React Native:安装到虚拟/物理设备失败

Posted

技术标签:

【中文标题】React Native:安装到虚拟/物理设备失败【英文标题】:React Native: Install to virtual/physical device failed 【发布时间】:2021-04-07 11:38:38 【问题描述】:

我目前正在使用 React Native 来编写我最后一年的项目。我在构建并将其安装到虚拟/物理设备时遇到问题虽然一个月前它运行良好。有人可以向我解释我的代码或文件有什么问题吗?它会损坏吗?因为我试图创建一个空白的新文件,我仍然得到同样的错误。

我的错误:

> Task :app:processDebugResources 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.2/userguide/command_line_interface.html#sec:command_line_warnings
183 actionable tasks: 2 executed, 181 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\minht\SmartRoom\node_modules\react-native-image-crop-picker\android\build\intermediates\library_manifest\debug\AndroidManifest.xml:10:5-14:15: AAPT: error: unexpected element <queries> found in <manifest>.


* 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 11s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

【问题讨论】:

尝试删除android->app->build中的build文件夹并再次运行。 我仍然得到相同的Task :app:processDebugResources FAILED 错误:( github.com/ivpusic/react-native-image-crop-picker/issues/1406 参考这个 在我更改build.gradles并重新安装所有node_modules后,问题变为Task :app:stripDebugDebugSymbols FAILEDTask :app:mergeDexDebug FAILED 【参考方案1】:

似乎您需要从 Android Studio 升级 Gradle,然后尝试是否可以从 Android Studio 运行您的项目。

【讨论】:

我尝试使用最新的 Gradle,但仍然无法使用 xd...

以上是关于React Native:安装到虚拟/物理设备失败的主要内容,如果未能解决你的问题,请参考以下文章

在物理设备上运行 React Native APP 时出错

React-Native 物理设备未连接到服务器

构建失败:如何解决 React Native iOS 虚拟设备应用构建失败、CompileSwift 和 CompileC 失败?

react-native run-android 失败,无法安装应用程序

react-native run-android 失败:无法在设备上安装应用程序,请阅读上面的错误

gl-react-native 不在物理 iOS 设备上显示图像