Cannot see Google Maps in signed application - android

I make use of Google Maps Android V2 in my application. When I run my app without signing things are perfect but when I sign my app I cannot see maps. I get lattitude and longitude but I cannot see my maps. All I could see is some blank white space. Please Help. I need to release the project soon..
EDIT
thanks guys i missed the part where I should sign with the app keystore i tried some commands but they didnt work. Tried these
1. C:\Program Files\Java\jdk1.6.0_19\bin>keytool.exe -list -alias compny -keystore
"C:\Users\PC8\Desktop\Sign Key" -storepass compny -keypass compny
and got this error
keytool error: java.lang.Exception: Keystore file exists, but is empty: C:\Users
\PC8\Desktop\Sign Key
2. C:\Program Files\Java\jdk1.6.0_19\bin>keytool -exportcert -alias androiddebugkey
-keystore "C:\Users\PC8\Desktop\Sign Key" -list -v
and got this error
keytool error: java.lang.Exception: Keystore file exists, but is empty: C:\Users
\PC8\Desktop\Sign Key
java.lang.Exception: Keystore file exists, but is empty: C:\Users\PC8\De
sktop\Sign Key
at sun.security.tools.KeyTool.doCommands(KeyTool.java:559)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)

This problem is because of map api key.
You need to sign your app and find .keystore for signed app. Right click on project Android Tools->Export Signed application pachage->next -> create new keystore then use this new keysore to find new SHA1 Now find new API key for your app. And replace the old map API key with this in manifest.
https://developers.google.com/console/help/new/#installedapplications
Next time whenever you want new signed app just use this keystore no need to create new again.

You are now probably trying to work with debug api-key which generated with debug.keystore file. You will have a private keystore file after signing your app. With this keystore file, you should get api-key which is private and named release api-key. Add this api-key to your projects meta-data then it will work.

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

Google maps v2 doesn't showing after publishing in play market

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.

how to sign in googlemap apk which key i used?

I'm creating Google map application i get my key from cmd using this command and get key from Google console ant tested in mobile is work fine but when i create apk and execution mobile is not show any map if i run directly application from eclipse to mobile is show map whats wrong in my sign in method? what keys i write when making apk
C:\Program Files\Java\jdk1.7.0_21\bin>keytool -list -v -keystore "C:\Users\S-tek
\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass and
roid
You need to use the same key as signing keystore instead of android default keys for getting map api keys .
For example: you are using xyz.keystore file to sign your application then instead of debug.keystore put the path and password of xyz.keystore file to generate the Map api keys.
to sign your apk
first have some tips from official site of android :
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