react-native - 错误命令失败:gradlew.bat app:installDebug
问题描述
当我运行“react-native run-android”或“npx react-native run-android”或“cd andriod ./gradlew clean”这些命令时,错误会显示
PS D:\work\Myproject-app> npx react-native run-android
info Starting JS server...
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Configure project :app
Reading env from: .env
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred evaluating project ':app'.
> A problem occurred starting process 'command 'security''
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified.
* 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 19s
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.
我也尝试使用最新版本的 Gradle!
操作系统 Windows 10 节点:14.2.0 Java:java 版本“1.8.0_251” Java(TM) SE 运行时环境(内部版本 1.8.0_251-b08) Java HotSpot(TM) 64 位服务器 VM(内部版本 25.251-b08,混合模式) ) Gradle 版本:5.1.1
JAVA_HOME、ANDROID_HOME 和添加到环境的路径
解决方案
我没有足够的代表发表评论,但是....
我今天遇到了这个问题。我的情况是该项目在 Mac 上运行良好。但是,我需要让它在 Windows 系统上运行。在我的 android\app\build.gradle 文件中,我设置了一个 getPassword 方法,它可以让我轻松签署我的 apk。在 getPassword 方法中,我有这个调用:
commandLine 'security', '-q', 'find-generic-password', '-a', currentUser, '-s', keyChain, '-w'
我注释掉了对 getPassword 方法的所有引用,它开始工作没有问题。
问题的根源在于 mac 使用的“安全”命令行工具在 Windows 上不可用。由于我现在还需要使用 Windows 框,因此我已经在外部凭据文件中配置了密码。
推荐阅读
- azure - HDInsight RM 模板部署失败
- javascript - 脚本没有保留属性
- vb.net - 由于提示错误而尝试停止保存过程
- javascript - 将数据从 ajax 传输到 PHP 的问题
- php - 如何使用 wordpress 中的 wp 菜单数组添加额外的 div
- pandas - 如何比较 2 个数据框列并根据结果向新数据框添加值
- azure - Azure AD 应用注册的安全隐患
- automation - 赛普拉斯 - 从 beforeEach 中排除测试
- reactjs - 当我单击反应表中显示的客户名称时无法获取用户详细信息
- azure - 如何解压缩我的 .zip 文件并存储在 ADL/Blob 存储中?