React Native无法构建APK文件 [英] React Native can't build APK file

查看:121
本文介绍了React Native无法构建APK文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此 http:/,我已经成功构建了react-native应用程序文件夹/facebook.github.io/react-native/docs/getting-started 文档

但是,当我在cmd中运行 react-native run-android 时,正在向我显示-

But, when I am running react-native run-android in cmd, it is showing me this -

info Starting JS server...
info Installing the app...
> Task :app:mergeDebugResources FAILED
9 actionable tasks: 8 executed, 1 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Specified AAPT2 executable does not exist: C:\Users\DE\.gradle\caches\transforms-2\files-2.1\e3571e1615ccf7c32524cbf1a8ed0eb8\aapt2-3.4.1-5326820-windows\aapt2.exe

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

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Specified AAPT2 executable does not exist: C:\Users\DE\.gradle\caches\transforms-2\files-2.1\e3571e1615ccf7c32524cbf1a8ed0eb8\aapt2-3.4.1-5326820-windows\aapt2.exe

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

    at checkExecSyncError (child_process.js:621:11)
    at execFileSync (child_process.js:639:15)
    at runOnAllDevices (C:\Users\DE\AwesomeApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
    at buildAndRun (C:\Users\DE\AwesomeApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:137:41)
    at C:\Users\DE\AwesomeApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:103:12
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
    at async Command.handleAction (C:\Users\DE\AwesomeApp\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)```

推荐答案

我已通过删除 .gradle 文件夹的缓存来解决此问题.路径为 C:\ Users \ DE \ .gradle \ caches .之后,应用程序开始构建.

I have resolved this problem by deleting the cache of .gradle folder. The path is C:\Users\DE\.gradle\caches . After that, apps are building.

这篇关于React Native无法构建APK文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆