首页 > 解决方案 > 任务 ':app:validateSigningDebug' 执行失败。在 ReactNative

问题描述

我正在尝试第一次运行该应用程序

C:\Users\Devrath\Desktop\React\ReactProjectFirst> npm run android

问题:我是否需要为简单地运行应用程序创建一个密钥库


错误:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
> Task :app:validateSigningDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 2 executed, 15 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningDebug'.
> Keystore file 'C:\Users\Devrath\Desktop\React\ReactProjectFirst\android\app\debug.keystore' not found for signing config 'debug'.

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

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:validateSigningDebug'.
> Keystore file 'C:\Users\Devrath\Desktop\React\ReactProjectFirst\android\app\debug.keystore' not found for signing config 'debug'.

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

    at checkExecSyncError (child_process.js:621:11)
    at execFileSync (child_process.js:639:15)
    at runOnAllDevices (C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
    at buildAndRun (C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
    at C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async Command.handleAction (C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! AwesomeProject@0.0.1 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the AwesomeProject@0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Devrath\AppData\Roaming\npm-cache\_logs\2019-08-12T11_38_19_074Z-debug.log

标签: react-native

解决方案


请确保您已按此顺序执行。

环境

  • 安卓工作室
  • Android Studio 中的内置模拟器
  • 节点包管理器 (NPM)
  • Node.js(版本 8 或更高版本)
  • React Native 命令行界面(React Native CLI)
  • Java 开发工具包(JDK 8 或更高版本)

  1. npm install -g react-native-cli
  2. react-native init ReactProjectFirst
  3. react-native run-android

推荐阅读