React Native Android Debug Keystore

20,177

Solution 1

Well turns out i just needed to rerun react-native run-android, didn't get my latest change in.

From the looks of it, by default android's settings will look at ~/.android for the debug keystore.

Solution 2

cd android/app/

run:

keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
Share:
20,177
Randy Song
Author by

Randy Song

By day: Software Engineer at Toast By night: Rock climbing, code writing extraordinaire. Hobbies: Dota 2, running

Updated on July 18, 2022

Comments

  • Randy Song
    Randy Song almost 2 years

    Question about generating API Keys for Android in React Native.

    I'm referencing these:

    https://developers.google.com/maps/documentation/android-api/signup#release-cert

    https://facebook.github.io/react-native/docs/signed-apk-android.html

    https://github.com/lelandrichardson/react-native-maps/blob/master/docs/installation.md

    What I'm wondering is, is how do I setup a debug API key for android if I'm NOT running on an emulator? I know I can use this command

    keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
    

    if I want to create a debug.keystore that the emulator can look at, but how does this work for when I want to compile, build an apk, and run on my device? Do I have to set a pointer to it in gradle.properties? Does React Native know to look in that folder for the debug.keystore, and incorporate it into the apk? I'm not really sure how these things work.

  • Ashok Devatwal
    Ashok Devatwal almost 5 years
    where we can set alias and password in react native project ?
  • Variag
    Variag over 4 years
    @AshokDevatwal most likely in Project folder\android\app\build.gradle in signingConfigs section
  • kub1x
    kub1x over 3 years
    The created debug.keystore file needs to be moved to ~/.android/ directory. Then rerun npx react-native run-android.