Expired Google Maps keystore certificate - android

When exporting my apk I've always used the temp.keystore I had and everything was ok - the Google Maps element was working as intended.
However the certificate expired (it was only 1 month, so that's understandable) and I couldn't export my apk anymore. Now even if I create a new keystore using a new API key or even a new debug.keystore (with a new SHA key) the Google Maps element is blank.
To sum up:
Google Maps worked fine
keystore certificate expired
can't export with the expired key
even with a new key the Google Maps element is blank
Is there something I'm doing wrong?

When you are developing app using google-maps-api, you can get sha1 with debug.keystore file. With this fingerprint, you can generate a new debug api-key which you can use on debug mode.
But if you will publish your app or export your signed app, you must use release api-key. How to generate this release api-key? It is simple. You should first sign your app and generate your private keystore file. With this keystore file you can get your sha1 fingerprint and then you can generate your release api-key with it. There is no time limit for this api-key. But there is a user limit if you use free google-maps-api.
In this way, i have published 2 apps and they are working well with their api-key.

Related

Release APK file not showing google maps

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 .

What is difference between 'debug.keystore' and 'release.keystore' in Android?

Recently, I was working with Android Maps V2. I came across debug.keystore and release.keystore. What is the difference between them? Why do we have to use both?
debug.keystore is merely for developing and testing purposes, so using that you can't release your app to Google Play using that only.
Caution: You should not release your application to the public (via any source) when signed with the debug certificate.
release.keystore is required only when you want to release your app to any app store.
For more information, see Signing Your Applications, subsection Signing in Release Mode.
You can work on developing the Android app with debug.keystore. The release.keystore will be need when your app is ready to be submitted as an app on Play Store.
debug.keystore is used at the time of development, where as release.keystore will be used at product release... link
debug.keystore you call for testing purposes for developers, because it contains the default alias and default key password and also by using this you can not publish your app into the play store.
release.keystore you call for the final app certification keystore. This keystore has its own alias and own key password. And for every new publish of your app, you must generate an signed APK file by using this keystore.
For more information, see Signing Your Applications.
You cannot publish your app to Google Play with debug.keystore, and users won't be able to download your app.
debug.keystore is used to generate Google Map API V2 key for Debug purpose . release.keystore is used to generate map key before uploading app to Google Play.

Sign Android App contains Google Maps

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.

Android Maps API2 release key working locally but not through Play Store

I am making an app that uses the Google Maps API V2. When building the App in debug mode, using the debug key the map gets displayed fine. The same is true, when I export the app using Eclipses export function and my production key, installing the app locally with:
adb install com.package.name
However when I publish the apk in the Play Store (as an alpha test) and download it on my device, no map is displayed, making me suspect that something goes wrong with the key.
I registered the production key in the API console and changed the maps key in the manifest to the new key, hence it works when I install it through ADB.
I also uninstalled the app, before the reinstallation from the Play Store and removed my debug key from the API console, to make sure that the release key gets used (and thereby is working correctly).
Any help would be greatly appreciated.
This is a late response, but I thought it might help others who might run into this similar problem. I too had all my release/debug keys generated correctly and the maps on my signed release apk works well through ADB install, but not after uploading to Google Play Store.
Here is my solution: With the new optional "Google Play App Signing" feature, your final SHA1 can be found in your Google Play Console -> Release Management -> App Signing. Add the SHA1 for the app signing certificate to your key restriction list for the API in your API console and your map should be working.
Apparently the generated SHA1 using my own keystore (release) prior to uploading, is different from the final one, after uploading into Google Play Store.
Hope this helps.
Go to the google Apis console and add one more entry with your debug key.
So then you will have an entry :
45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:-- blah blah production key;com.package.name
45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:--yada yada debug key;com.package.name
//The keys I used are random you will get them both running the following command for each keystore ( debug and production )
Use this command to get the key :
keytool -list -v -keystore mystore.keystore
tl;dr two keys one for debug one for production and two entries to the Google Api Console
I fixed the problem by creating a new app and a new certificate. I don't consider this a "solution" since I did not find out what went wrong in the first place.
Basically whenever in the case of Google Map, we need an API key, which is generated on the basis of SH1 key of keystore.
When you work on local system, then we have to use the SH1 key which is displayed in Eclipse. But when we sign our application to make an APK to upload on playstore, we need to edit the exiting key and replace the old SH1 key with a newer SH1 key.
Note: You can get the newer SH1, while signing the APK for playstore. While signing it display the SH1 key of of keystore file, which you are using for that particular application for Playstore.

MapView gone after publishing app in market.

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.

Categories

Resources