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
Related
I've got blank screen only at release version.
(debug is fine.)
I've tried most of answer in stackoverflow... but it didn't works....
Please check below images.
I've put the key on debug & release xml and also make them list on console.developers.google.com.
What kind of things I can do more??
(And this is basic project what Android studio support which I can choose when I made new project at Android studio.)
enter image description hereenter image description here
First check on your Google Map Console's account whether your API is restricted or public.
if it is restricted for android then you have to provide package name with SHA1.
you can generate your SHA1 from command prompt
keytool -export -alias YourAliasName -keystore "your_jsk_path" -list -v
and also after deploying on playstore you have to add that SHA1.
you can get that SHA1 from Release Management > App Signing >App Signing Certificate.
for a debug keystore (when run a application directly out of android studio which is working with google play services - doing a sign in and so on) you have to make a debug keystore. But with the new feature "Google Play App Signing" the generated keystore is a "Upload Key (google invented it)" with a special Upload Signature. The problem is (i guess) that i need a debug keystore with an App Signature (i guess). So the question is: How can i create a debug keystore with the "App signature" (the MD5 and SHA-1 i know for this), to make it possible to run signed apps out of the IDE that can sign into google play services?
Debug keystores are automatically created for you by Android Studio the first time you run or debug your project in Android Studio in $HOME/.android/debug.keystore, and sets the keystore and key passwords.
However, if you're looking to sign your app, you can execute this command in the command line:
keytool -genkey -v -keystore my-release-key.jks
-keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
If you want to find the debug.keystore command, then you can go to google cloud platform, then credentials from left menu.
After that, find your application, check the package name and click on it.
In new window, you should find a command to regenerate your debug.keystore.
You can create a new one(debug or release or profile) from android studio:
go to build generate signed Bundle/Apk
then click next then create new
then enter the red info & click next
choose keystore type
My user cannot login using google sign in after downloading my app. At first I believe its sha1 problem, so I created one for release using keytool with my keystore.
What I've done:
Copied the sha1 to my firebase project setting
Downloaded the googlejson file, put it in my project.
Generate signed apk using the same keystore.
Currently I think I have two sha1 fingerprint certificate listed in my firebase project setting, debug and release version.
The weird thing is I can successfully login by running the apk-release.apk from generate signed apk which I directly copied from my pc to my phone. ( I uninstalled the old and install fresh the app). That is the same apk I uploaded to the google play console for public. I don't understand why I get different result.
I finally figured it out, for those who have this problem:
i have to get the SHA1 genereated from google play console. its on the Release Management --> App Signing.
if you use firebase, just add that SHA1 to your project setting
keytool -list -v -keystore {keystore_name} -alias {alias_name}
Pass your project's keystore-name and alias-name and get SHA1 key. Create credentials using that SHA1.
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
i have some problem, my app works fine, but when i load it in Play market, maps does not works correctly. I make next:
Get SHA1 keytool -list -v -keystore C:\User\Name/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
In Google console i create API KEY. SHA1;com.kostya.app
Rigth click on project - Android tools - Export signed application packuage
Create new keystore and new *.apk file.
Load it into market.
Where is my mistake? I read this article. Together we can create nice tutorial how to sign app using google maps v2. How to test application at once after loading in play market, without weithing some ours.
When your are creating keystore for creating signed apk you have to do this.
change debug.keystore to your created keystore
change alias name to your project name
set the password the same like in your created keystore (not android as in debug mode)
keytool -list -v -keystore ~/.android/ YOUR_KEYSTORE -alias YOUR_PROJECT_NAME
more help find here
after publishing the app on play store.
on Google Play Console
Goto:
Release Management >App Signing
from "App signing certificate" copy SHA1 and paste it on Google cloud platform API console.
You have to create a production keystore, you should not use the debug.keystore.
Check out the documentation.
Just Add the apikey to debug>res>values>google_maps_api.xml
add in release>res>values>google_maps_api.xml files.
Just generate SHA1 using
keytool -list -v -keystore mystore.keystore
go and add the package name and SHA1 fingerprint to the already generated
I used Android studio to generate the release keystore. After tried many ways for two days I finally got this to work. The problem is that when generating signed APK in Android Studio either by choosing the existing keystore or creating a new one, the default format for the keystore file is ".jks". That is the problem. After I changed that to ".keystore" and generated the release apk, and then copied the SHA1 into google console. The map can finally be showing.