Blaze Tama
Blaze Tama

Reputation: 10948

Do we need to change Google Maps API key when changing computer?

The Google Maps API key is generated by SHA1 from keytool on computer A.

Now i checkout the project on computer B (which means different SHA1).

Should i re-generate the key, or can i use the existing key?

Im not sure about this because my BroadcastReceiver suddenly not getting called when i checkout to computer B with same code.

Thanks a lot for your help

Upvotes: 1

Views: 438

Answers (4)

Keith
Keith

Reputation: 635

Generate a new key for each computer.

I have a md file or text file for the project where I store my keys and depending on the computer, I just switch them out before building.

Upvotes: 0

Nanoc
Nanoc

Reputation: 2381

If you were using the debug key, you will need to copy it to the new computer or use the new generated one, so you have to change the hash.

If you were using the release key you dont need to do anything more.

Hope this helps.

Upvotes: 1

fractalwrench
fractalwrench

Reputation: 4076

You can use the same debug key across multiple machines by changing the signingConfig in your build.gradle.

signingConfigs {
    debug {
        keyAlias 'androiddebugkey'
        storeFile file('..' + File.separator + 'debug.keystore')
        keyPassword "android"
        storePassword "android"
    }
}

This assumes that your debug keystore has been copied to the root of your project.

Upvotes: 2

vguzzi
vguzzi

Reputation: 2428

I would recommend not setting a SHA1 when developing an app and keeping it blank. This would allow Google Maps to just work all of the time with that key. Then set one when signing your app before released, it would then be linked to your keystore.

Upvotes: 0

Related Questions