* What went wrong: Execution failed for task ‘:app:validateSigningDebug’. > Keystore file ‘debug.keystore’ not found for signing config ‘debug’.

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Having trouble running getting your React Native app to run? Haven’t worked on it in a month or two? Now you’re running into this error about debug.keystore not found? Fret not dear internet friend! Here are some solutions that may help.

I personally ran into this error after cloning a previous version of an app that I was working on from Github. Like you, I ended up trying many different things to fix this problem. However, I’m not sure if any of the steps I performed prior to stumbling upon a good solution were necessary. But just to make sure, I’m going to include some of the steps that I took before getting my app to work again in case any of these steps may be helpful or necessary to anyone else out there on the internet.

First I installed all of my node packages with npm…

$ cd MyAwesomeReactNativeApp 

$ npm install 

After installing all of my node dependencies I then attempted to run the app for the first time and ran into the error message described above. My first attempt at fixing the problem involved attempting to reinstall all of my native Android dependencies with gradle…

$ cd android

$ ./gradlew build --refresh-dependencies

$ ./gradlew clean

I’m not sure if this is ever necessary for Android like it is for iOS with cocoapods and pod install, but it is something I did, but it probably didn’t actually do anything and likely wasn’t necessary.

Next, I attempted to create a new debug.keystore file myself using the following terminal commands:

$ cd android/app

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

Unfortunately this didn’t actually work! But what did work was importing my project into Android Studio, cleaning the build folder from within Android Studio, and then running the app on the built-in Android emulator instead of my actual Android device. Please note that I was prompted with an error message when running the app on the simulator that Android Studio wanted to delete the previous version of the app installed on my emulator, so please make sure to do this if your are prompted for something similar.

Also, please note that I deleted the old version of my app from my physical phone before attempting to run the app on my personal device as well. However, this was not sufficient to solve the problem. In conclusion, you need to make sure you delete any old versions of the app that were signed with old keys from your emulator or device AND then use Android Studio to clean your build folder and run the app. In my case, I believe Android Studio handled fixing all of the issues related to the mismatched debug.keystore files behind the scenes for me, so if you are stuck on this, I suggest you let Android Studio fix the problem for you as well.

Hope you found this blog post helpful.

@topherPedersen

P.S. This was the first time I worked on this particular app since publishing it on the Google Play Store. So signing the production release of the app was probably a big part of the problem as well. Whatever the exact cause, the steps above should fix the issue.

 

topherPedersen