I created one small app in which I used Google Maps API v2.
For testing and debugging, I used the default debug keystore that is generated named as debug.keystore.
I generated my SHA key that has to be provided for using maps and generated api key and used in my application. I signed the application using EXPORT wizard in eclipse and am creating my new key store for my app and generating application apk.
But now when I am trying to run this app on device the MAP is not displayed.
As I suspect this is due to new keystore for my app and i have registered my debug keystore SHA key to google console.
What am i doing wrong here and how can i fix it?
While signing an application with different keystore from debug one, you should create another API_KEY using SHA1 generated from your current keystore and register it in Google API Console and use that key for Google Maps. Your maps won't show up,because API_KEY is generated by the current keystore and your package name. Changing keystore file will cause your MapView to shows blank, because SHA1 is different.
So as a final answer, you should repeat all steps to generate an API_KEY for Google Maps with new SHA1.
Edit: There are two options which you can use to create SHA1 from keystore file.
keytool -list -v -keystore <path_to_your_keystore> will give you SHA1.
Using Eclipse if you try to sign your app with your keystore, at the end before saving your .apk file it will shows you SHA1 and MD5 generated from your keystore. I think it was the second time when you try to sign apk.
Related
I am reading the following documentation to get a Google Maps API key for Google Maps V2:
https://developers.google.com/maps/documentation/android-api/signup
It says you must locate your release certificate keystore file and run the following:
keytool -list -v -keystore your_keystore_name -alias your_alias_name
And then copy the SHA1 line of the certificate's SHA-1 fingerprint to the Google API Console.
But wait a second. When you generate the keystore, it means you are ready to publish the app. But if you have to generate the Google Maps Key AFTER you generate the keystore, doesn't that mean you have to generate the keystore again to reflect the changes made to the AndroidManifest.xml where you added the Google Maps key?
The keystore contains a certificate. A certificate confirms the identity of the person who signs the app and it can never be changed once you upload your app. Different certificate means different person even if the metadata (e.g. name, organization etc) are the same.
doesn't that mean you have to generate the keystore again to reflect the changes made to the AndroidManifest.xml where you added the Google Maps key?
The answer is no. You don't have to generate new keystore (doing so you will not be able to update your published app). You just have to resign your updated apk with your existing certificate.
Google Maps API doesn't work in a signed app even though I created SHA1 with my keystore key and my password like on Google's developer site. And Google Maps doesn't work. Please help me.
Thanks everyone. I solved the problem by pressing the "regenerate key" button on the Developer Console.
you are using developer version of sha1. you need to again generate SHA1 using command prompt after making you apk signed.Steps to regenerate SHA1 is go to cmd and give the command like below:
C:\Program Files\Java\jre1.8.0_91\bin>keytool -list -v -keystore
"C:\Your key store path\keystores\android.jks"
go to your java in program file open java version like jre1.8.0 open bin folder and run command like above follwed by your key store path that you have generated when you generated the signed apk
after running this command on cmd you need to provide password of signed app and your SHA1 will be gerarated.copy the sha1 and paste into console.developer with your package name within your api key.
I ran into the same problem and my issue was that I was using my keystore key -- but this is only the key used for uploading the app, Google has a separate key for signing the app.
I was able to find the key for signing in the Google Play Console under Release Management > App signing > App signing certificate.
I applied the exact steps as mentioned in the google developer doc to create an example google map project and everything went fine on the emulator, but when I generated the project apk file and launched it on real device Samsung Galaxy S4 google map doesn't show up it shows only a blank background with just colored Google logo appearing on the left lower screen corner !!
I created new project for google map I created new .jks file for the project and created store and key pass and alias then I extracted the SHA1 from cmd java bin I went to dev.google.com/console created new project then enabled google maps android API then created API key from Credentials pasted this API key in place in google_maps_api.xml in my project updated the signingConfigs release with the .jks file path and alias and two passwords. then generated signed APK from Android Studio then transferred the app-release.apk to real device then installed it same problem google map NOT showing.
Reason for this issue
This occurred because there are different SHA1s in debug and release types.
Fix for this issue
Add the SHA1 of the keystore used to build the release APK to Google console
Steps:
Get the path of the keystore when you generate signed APK
Build ----> Generate Signed APK..
Save the key store path
Remember to make Build Type --- release
Extract SHA1 from the keystore.
Open your terminal use command below:
keytool -list -v -keystore "/Users/NT/Desktop/generalkey.jks"
You will be asked for password for your keystore.
Change path to your keystore path keytool -list -v -keystore "keystore path"
From the Certificate fingerprints, you will see the SHA1
Generate android key using this SHA1 and your package name
Generate APK using keystore and enjoy your map
It might be silly but I had my API key included in
app\src\debug\res\values\google_maps_api.xml (debug)
You also need to include in-
app\src\release\res\values\google_maps_api.xml (release)
if any one still facing this problem :
this happend to me because we need two google maps api keys one for the debug and another one for the release, you can check in :
C:\Users\username\AndroidStudioProjects\yourapp\app\src\ debug \res\values
and you'll find an xml with your api key like:
<string name="google_maps_key" templateMergeStrategy="preserve"
translatable="false">AIza...etc</string>
but if you check here:
C:\Users\username\AndroidStudioProjects\yourapp\app\src\ release \res\values
you will find an xml but without api key inside like:
<string name="google_maps_key" templateMergeStrategy="preserve"
translatable="false">YOUR_KEY_HERE</string>
it was noted as a comment inside the xml file itself :
Before you release your application, you need a Google Maps API key.
To do this, you can either add your release key credentials to your existing
key, or create a new key.
Note that this file specifies the API key for the release build target.
If you have previously set up a key for the debug target with the debug signing certificate,
you will also need to set up a key for your release certificate.
Follow the directions here:
https://developers.google.com/maps/documentation/android/signup
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
Check the following things:
This below file should be in both debug and release
app\src\debug\res\values\google_maps_api.xml (debug)
You also need to include in
app\src\release\res\values\google_maps_api.xml (release)
Add the SHA1 for release apk into Google Api Console.
You can get SHA1 key from play console >> App Signing >> SHA1 Certificate
Another additional step:
In google play developer console add App Signing SHA1 fingerprint:
now google signed apk before publish on store,so go to google pushish app ---> app signning , and add signed key to google developer console,you shoud add 3 key sha1 : debug,release and new sha1 key after pushlish
if signing keys are being managed by google play console, for your case, do this
Get the SHA-1 certificate fingerprint from google play console >> your app >> Setup >> app integrity (this is different than the one you used when you sign your app)
Go to your google cloude api key credentials and add the SHA-1 you took from the google play console.
That is it it worked for me.
Google now signs the APK before publishing on the store. Start by selecting your app in google play. Under Release ---> Setup ---> App integrity. Once there you should see the App signing key Certificate. You will see an additional SHA-1 key.
You'll need to add this key into the google developer console. You should have 3 SHA-1 keys : debug, release and the new SHA-1 key after publishing your app.
For showing the map in release version of android apk, developer needs to add the updated SHA-1 key, created by Google Play console after publishing the application. Go to App Signing section of the console and look for 'App Signing Certificate: SHA-1 Certificate Fingerprint'. Copy the fingerprint and paste it in Google API Console where developer has created the Google API key for map.
for all those out there who tried every thing and still not getting the google map to show up in the release version, try to first:
1- install the release.apk on your phone or emulator
2- open the logcat window and set it on your phone device (if using emulator its set on it by default)
3- open the map and it shows the error like below, copy the key and paste in the value tag below in the Manifest file :
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="" />
I also had the same issue of map when I'm making the apk , make apk in the same system in which system you have made the google map key then the map will work and show perfectly .
i'm going crazy with this problem. I have my app with debug api key, all works. I make next
Android-tools - Export Signed Application packuage - i have created a new keystore and .apk file
C:\Users\Kostya>keytool -list -v -keystore D:\AndroidApps\cars51release\cars51ru_keystore -alias cars51_alias - i get new SHA1 , put it on console and get api key?? Is this a release api key?
What i must do next? Replace API key in Manifest? How to get reade for publishing apk ?
For release
1- Generate SH1 code with the good keystore, good command line
2- In google MAP API console click create a new APIKEY copy/paste the SH1 code and then enter the package name (for example : erg46re5g46erg54;com.appli.mainpackage, this is the package name at top of your manifest) it'll generate the APIKEY you need client side
3- Copy/Paste the generated APIKEY in your manifest
4- Generate signed APK with the same keystore (you can test it on your Nexus4 smartphone X)
5- Upload APK on google play
6- test
With the new SHA1 key go to the google developer console and get the release API key. With the new google maps API key, go to your app's manifest file and paste the new api key where required. Export you app again and sign it with the keystore from witch you got the new SHA1 and it should work.
I am using Google maps, my map view is working in debug mode and my last app uploaded is working fine, but when i export it with the release key and same keystore the map-view is not showing further, please help. I have tried with same keystore and new keystore.
i didn't found the solution.
I have mentioned i used these keys i got keys.
even new debug keystore, debug key from keytool and Api from google console
Open Command Promt
Goto your SDK location (for ex, c:\android-sdk\tools)
I:\keypath\my-release-key.keystore = it is your release key location which you use to sign your app
type below and press enter
keytool -v -list -keystore I:\Android\1_RELEASED_APP\0-key\my-release-key.keystore
it asks for key password type it and click enter,
then it generates and hash code
copy that code and
goto there
Generate your key with this hash code, and use it(MD5) your application which you will publish.
You need to obtain the API key for the signing certificate and replace it.
Obtain map key
There's a difference between the debug.keystore and release keystore. Your bold lines in your question state you generated new Debug Keys, which you should not do. Each time you update your app on the market, you should sign it with the same key as before; not generating new keys each time.
You need to get a signed API Key; which can be generated by using the same key you are signing your application with.
https://developers.google.com/maps/documentation/android/mapkey has some more info on it.
If you generate a new keystore key, you also need to generate a new Google Maps API Key as well.
You have two things to look for:
1> Your are using the same keystore to sign your application which you used to obtain google map keys.
2> You are signing your application from the same machine your signed earlier.
There should not be any problem if you have done these things.