android - 我无法让我的 android 应用在 react-native 上运行
问题描述
我无法运行我的项目。我正在尝试修复 2 个错误,但我一无所获。
我做了这里写的一切:
https://facebook.github.io/react-native/docs/getting-started
C:\WINDOWS\system32>cd BabyMobile
C:\Windows\System32\BabyMobile>react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details
> Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Windows\System32\BabyMobile\android\app\build\intermediates\res\merged\debug: error: directory does not exist.
* 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 26s
9 actionable tasks: 1 executed, 8 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
C:\Windows\System32\BabyMobile>adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
你能帮我么?
**修复:更新了 android studio,项目在普通 CMD 中初始化(不是管理员)。第二个问题是,我在运行 react-natice run-android 后打开了模拟器,所以你必须先启动模拟器!
解决方案
推荐阅读
- azure - 将 Data Lake Storage Gen 2 与 Databricks 连接起来
- python - 在 Plotly Dash 中访问跟踪状态
- asp.net-core - 带有 AddCookie 的 AddAuthentication 重定向到 http 而不是 https
- matrix - 酉矩阵的数值对角化
- python - Pandas:将标量添加到现有数据框中的多个新列
- python - 如何使用 Python 将 2 列写入/追加到 .txt 文件中?
- powershell - 为什么 Set-AzStorageBlobContent 任务状态始终保持活动状态且从未完成?
- python - 有没有办法从 Flask 用户输入中动态查询 postgres 数据库?
- javascript - OctoberCms 如何将ajax响应传递给javascript函数
- regex - 正则表达式:从 sting 中去除 HTML 标签,但将电子邮件地址留在“<>”中