React Native Task :app:validateSigningDebug FAILED

2020-05-18 11:29发布

问题:

I am completely new to react-native and android. I have downloaded a project from Github and used commands yarn install and react-native run-android to run the project. but getting this error. Can't seem to understand the reason. What should I do?

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: 17 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningDebug'.
> Keystore file '/home/tawsif/react native/react-native-redux/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 4s

回答1:

The problem is that the build is looking for the debug keystore and cannot find it.

Keystore file /home/tawsif/react native/react-native-redux/android/app/debug.keystore not found for signing config 'debug'.

There's an issue with the same problem in React Native GitHub. According to the page, you can solve it by creating a debug keystore. Quote from the thread:

You can generate the debug keystore by running this command in the android/app/ directory: keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

Link to the issue: https://github.com/facebook/react-native/issues/25629



回答2:

Based on @rabbit87's answer the solution is running the following command inside ProjectName/Andoid/app directory solves the problem

keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000


回答3:

Just download from official template https://raw.githubusercontent.com/facebook/react-native/master/template/android/app/debug.keystore

Copy debug.keystore into your android/app/.

Ex: mv ~/Downloads/debug.keystore /Users/lazaro/apps/myapp/android/app/

ref: https://github.com/facebook/react-native/issues/25629#issuecomment-513245590



回答4:

I was having same error, It was solved by this https://coderwall.com/p/r09hoq/android-generate-release-debug-keystores

do

cd ./android/app/

and then

keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000