Map tile not loading only with release certifcate android? - android

I have checked a lot of questions around map tiles not loading on android device. I have not been able to fix the same error I have.
I am able to test on both emulator and device my mapsview in my application with the debug key. It works absolutely fine. I had generated a maps api key for my debug certificate.
I then created a maps api key for my release certificate with its MD5. I have added that to my maps view and now the application is not working.
I have added android internet permission in the correct place in manifest file.
I have correctly generated the MD5 finger print as I did for debug key.
I have only one mapview in my app so I have just changed that api key in the layout xml.
Only difference in generating key for debug and release is this: In the command options for keytool for the release certificate I was asked passsword only once which I presume is the store pass. my key pass was never asked (actually they are the same)
I generated debug keystore MD5 like this
$ keytool -list -alias androiddebugkey \
-keystore <path_to_debug_keystore>.keystore \
-storepass android -keypass android
I created the release key MD5 like this
$ keytool -list -alias myalias_name -keystore "mykeystorepath"
I have also tested the app with the android store still no luck. What am I missing? Any help is greatly appreciated, thanks guys!

use eclipse for generating the key and exporting, also don't rely on the DEBUG variable( Android: automatically choose debug/release Maps api key? ) to switch at runtime the keys because that's broken at the moment, you have to export the app, get the md5, get the key based on this new md5, switch the map key, reexport
edit:
important steps of https://developers.google.com/maps/documentation/android/mapkey
1) $ keytool -list -alias alias_name -keystore my-release-key.keystore (NOT DEBUG KEY)
2) https://developers.google.com/android/maps-api-signup
3) update code with new key
4) clean project & build (important to clean, eclipse doesn't always do it)
5) export with eclipse

Ok all, here is how silly it was. All was fine except for the fact that I placed the key in a layout file that I was not using. Probably I was out of my mind. So quickly
The maps application will work with release key even if you just export signed application. It is not necessary that the application be put in Android store for it to work. There are some misleading comments in stack overflow that state this.
The keytool will ask for password of the keystore and it will use the same to unlock the alias key too. Only if it is different it will ask again.
The maps application with release key will work with emulator too. Just rmbr to use install adb ""

Related

Android map not working in built apk version

I have developed an android application which has a map fragment in it. I got the "map key" from "google developer console" by specifying my project's package name and other required details.
I generally test my application by connecting an actual device to my machine and everything works ok. But when i build an apk as a debug or release version and install the apk in the same/different device, it doesn't show the map at-all.
I use Android Studio for development and build process.
How do i fix this issue? I am definitely sure that its something to do with the key not being picked properly when i build the apk but i am not sure how to fix this issue!
Update 1:
I figured out the problem using all of your suggestion. The part which i missing was that i was generating a new keystore in Android studio using "Generate signed apk" so that my apk is signed with the new SHA-1 for the release but i was not telling google that it needs to consider my new SHA-1.
So i did the following
I went on the terminal/command prompt, got the newly created SHA-1. I used the command "keytool -list -keystore my_key_store_name.jks -alias my_key_store_alias_name" . This displayed my SHA-1
I copied the SHA-1 and went to google developer console and added the project's package name and the new SHA-1
After the above steps, my map is displayed properly. :)
Thanks everyone for helping me solve it.
When you run app without creating apk then it will take your debug keystore as a keystore and you have set that key on developer console.
When you create apk then that apk will get created using different keystore i.e your app keystore.
keytool -list -v -keystore ~/.android/debug.keystore -alias
androiddebugkey -storepass android -keypass android
keytool -list -v -keystore kestore_location -alias kestore_alias_name
-storepass android -keypass kestore_pasword
So has-key created using that keystore is not set on developer console.
You just need to create new hash-key using app kestore and add it on developer keystore.
It will display map.
While building your application and installing it directly from studio, studio will use the debug key.But while releasing the app, the apk has to be signed with release key instead of debug key.The Android SDK tools generate this release certificate when you do a release build.
So for generating the map key, if you are in development phase, you can use debug key to generate map key. But when you release the app, you have to obtain new map key using the release key and replace that in your manifest file.
Regarding signing your app, refer this link and this so
I think there is problem with SHA. Please check once again for SHA.
Follow these steps to find correct SHA and match with console SHA
In Android Studio:
1. on right side of window just click on Gradle
2. refresh
3. app---> task---->android--->signingReport
4. SHA will display on Console
the generated SHA add on google console.
Happy Mapping

Generate api key for google map while publishing the app

I am trying to do dis more than an hour but unable to find the apt solution.
My app is ready, so i am trying to export it using signed application option in eclipse IDE.
the apk file is getting generated
But the problem is the google map inside map whose API Key was generated using default debug keystore is not working.
So i need to create a new API key by creating a new keystore.
How does it go?
please explain
using your new keystore find the SHA1 key from eclipse and create a new API key for google map.
You don't need another API key anymore, you just have to add the SHA1 finger print of the keystore you use for creating the signed APK to the existing API key:
Supposing you have created your API key in the API Console, go there again and click the 'Edit allowed Android Applications' button below your already existing API Key.
There, add a new line with the SHA1 finger print of the keystore you used to create the signed APK and the package name of your app (it's explained anyways when you hit that button) and you're done.
The Eclipse debug key for signing your application can be found in the userhome/.android/debug.keystore file.
To create the SHA-1 for your debug keystore you use the keytool command from your JDK installation pointing to the debug.keystore file.
keytool -list -v -alias androiddebugkey \
-keystore <path_to_debug_keystore>debug.keystore \
-storepass android -keypass android
Copy the SHA-1 output, as you need this later.
In the console, You need to create a new Android key in pulbic api acccess.
You need to get the SHA1
keytool -list -v -keystore mystore.keystore
You can use this command to get SHA-1 to get Api-Key. Here's link
keytool -list -keystore your_keystore_name
If you don't want to regenerate or re assign the key, then go to Google APi console and Enable the Api-Key for all application either signed or unsigned

App is published but we keep developing new features. Should I use debug or release keystore to get the SHA for Google Maps Api Key?

The app is in Google Play
now Im adding a new feature which requires Google Maps.
Ive never dealth with Maps.
Im reading in the documentation I need to get the SHA of the keystore,
but which keystore - a debug one or the release one?
I suppose I will be debugging and testing and working on the temporary apks while implementing the feature, so should I use the debug keystore?
On the other hand I already have a release keystore and the app is officially out there, so maybe I should use the release keystore?
I also found this command was supposed to print the sha:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
question is, if you say I should use the release keystore, should I change this word
androiddebugkey
to something else, and if yes, what to?
also, should I copy and paste it by the letter, or should I change something?
you need both, the debug key is for when you are building through Eclipse/Android Studio to test and then your release key is for when you release the app to the play store

What is Release key for Android Map v2? How it would be generated?

I am confused from the thing which I have experienced
I use Google Map API v2 for my application. I have use the map
fragment to display the map. It works fine on many of devices above to
2.2. It works perfectly when running direct to device but when I export application to a *.apk and then install into the device, run
the application, It only show white screen.....
I have search for this problem, the solution comes that use API KEY with the signing of apk. I dont know how to sign the apk? And what is the release key?
Please help me I am stuck from last 2 days. Thanks in advance..
Facing this error..
UPDATE :
My mistake is that I have not used the SHA fingerprint which is
generated when apk is created. It is displayed first time in the console
and next time on to the apk export screen.
Here are screen shots of the same
FIRST TIME OF APK CREATION :
NEXT TIME :
Thanks everyone for your valuable suggestions and responses. Thanks.
You need to do the following things to get your Maps Visible for both Debug Mode and release mode
-1 Add debug key to package combination at Google API console
-2 Add release key to page combination at Google API Console
Note : you need to add at lease 2 combination to get your maps visible when you are testing and when you generate *.apk file.
What you are missing right now is not adding the release key to application package combination to API console add this and after that do the following:
replace your debug map key with release key and generate your *.apk and install aplication to your device you will get your maps
there are several Tutorial available on net i would to suggest you the following one
Google Maps
To Generate the Release key do the following steps
Open CMD (in Windows) terminal (in Linux?MAC os) find the path to your jdk dir and then to bin like following:
C:\path-to-jdk\jdk1.7.0_07\bin>keytool -v -list -alias tt -keystore path-to-keystore -storepass password -keypass passowrd
for me the path is following for Jdk/bin and that for key store
C:\Program Files\Java\jdk1.7.0_07\bin>keytool -v -list -alias tt -keystore D:\ke
yStore -storepass password -keypass password
you need to give the following things of your own
-1 path to jdk
-2 path to keystore
-3 keystore passoword
-4 keypass password
You can generate api key here: https://code.google.com/apis/console/‎
About release key, it's this article: http://developer.android.com/tools/publishing/app-signing.html But this is not required, default sign by debug.keystore. Below nice tutorial about this.
Here is official Google tutorial about map v.2: https://developers.google.com/maps/documentation/android/start
I have a good tutorial regarding this, each step is explained via screenshot
http://androidstudies.wordpress.com/2013/05/30/view-map-in-you-android-applicatiopn/
actually Api key is for security purpose so that no fake requests are sent to google server(some times hackers do such things)
There are two keys.Debug and release key. Debug key works for unsigned apk and release key works for signed apk. If you signed your apk by means of debug key, then your map looks blank.
So if you export your application, use release key.
Release key procedure, you can follow here.
Google Map Android API v2 can't display map in play store application
Follow this step by step process:
step1:Create key store
C:\Program Files\Java\jdk1.7.0_21\bin>keytool -genkey -v -keystore keystorename.ke
ystore -alias pwd -keyalg RSA -keysize 2048 -validity 10000
step2: convert all required android projects to ant project to run 'ant release'
E:\myworkspace\sample\myproject>android update project --path .
step3:Run ant release
E:\myworkspace\sample\myproject>ant release
Step 4: Sign apk
E:\myworkspace\sample\myproject>jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore path\to\keystore path\to\generate\unsigned.apk pwd
Step 5: verify signed jar
E:\myworkspace\sample\myproject>jarsigner -verify -verbose -certs path\to\generate\unsigned.apk
Step 6: align apk
E:\myworkspace\sample\myproject>zipalign -v 4 path\to\generate\unsigned.apk "path\to\final\released\final.apk"
Refer this link: http://developer.android.com/tools/publishing/app-signing.html

Android Google Maps not showing in signed apk V2

My Android app works fine on device without signing but Once I export signed apk file maps no more render
Do we need to create new API key for release even with V2 if yes please suggest any link that I should follow to create release API key
You don't need a separate API key for your release signing key. The only thing you need to do, is adding SHA of release key on APIs Console, so you have two lines there instead of one:
D3:49:EF:3D:0E:...:D5:5F:59:46:11:C1:85;pl.mg6.android.maps.extensions.demo
C1:3A:96:3E:F8:...:4D:F1:52:77:D0:01:0E;pl.mg6.android.maps.extensions.demo
#MaciejGórski is correct. Below is small details to it.
In the Google Api console, where we have created the API KEY we have an option to add multiple finger prints to the same key. What I did was adding two SHA1 finger print for my debug keystore and release keystore and the same API key worked for me.
Note the below is for Ubuntu specifically:
Get SHA1 for the debug using the below command
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
For getting SHA1 for release the command changes to
keytool -list -v -keystore /home/atul/Desktop/Learnings/Projects/TestApp/keystore.jks -alias test -storepass password -keypass password
where
/home/atul/Desktop/Learnings/Projects/TestApp/keystore.jks is the path where my keystore file for the signed apk is present
test is the key alias name used while genrating the signed key store
and password is the password used while signing the apk
Hope this helps. Happy coding :)
make sure that you have release key in your "google_maps_api.xml" file in release folder,
Go to you app > app > src > release > res > values > google_maps_api.xml
and put your generated key in "google_maps_key" string .
somthing like this:
AIzaSyC3I-3mVulW2TNw_vmil_wGdNj11w5rrFg
its work for me :)

Categories

Resources