do i have to publish the apk everytime in order for the map to show? My map won't display while running via eclipse, i have to export to apk and then install on my deivce to test. Is there a easier way to test a map v2 apk? Thank you!
First thing you have to Use your debug.keystore file from .android folder and then generate SHA1 using that keystore.... in Command Propmt.
And then you have to generate your Google Map v2 API key using this SHA-1 from Google API Console.
And use this key in your application and you don't need to Export your Signed application..
Thanks..!!
You can't display maps in the Emulator since it doesn't have Maps installed in it. You must run all the Maps related applications in your android device.
Also, Just connect your device to the PC/laptop and eclipse will automatically prompt in which device you want to run and then you can select your device.
Its because there is no maps in your emulator. Your map will display only on a pure AVD, i.e. it CPU of emulator must be ARM, and the target should be a Google APIs device. For Maps V2, you need google play services installed in your emulator/device. By default its not available in any emulators.
You can force install google play services into an emulator, follow this for a start.
The better option is to use a device(mobile/tab) via USB with developer options enabled (USB Debugging checked).
Try it...
Use this command to generate SHA1 certificate with your debug.keystore, than generate API key with generated SHA1 certificate
How can I get the MD5 fingerprint from Java's keytool, not only SHA-1?
After generating key from API console use that key to your Manifest file.
There is, but you need to modify your debug key in eclipse (I'm assuming you are using eclipse).
First off, The google mapview stuff only shows when the Api key you are using is derived from the signing key. Here lies the problem - eclipse uses its own default key when you're launching from the IDE.
So you need to use your actual signing key for the debug. If you go to Window -> Preferences -> Android -> Build, you will see that eclipse is using a default debug keystore.
You have there the option to use a custom debug keystore. BUT NO WAY TO SET CUSTOM PASSWORD.
Good thing you can change the password on your original signing key (I prefer to create a copy and tag that as my "debug" key) and still retain all/most of its properties, I honestly don't know which ones, such that you can now use it as a debug keystore and still have it display the google maps layout.
To change keystore password just fire up cmd and do:
keytool -storepasswd -keystore my.keystore
Eclipse uses "android" as the default password for debugging, that's what you enter as new password.
After modifying your key, you can now set it as the custom debug keystore and start going Ctrl+F11 on your android source.
As far as I know, you can even override installation of the normally-signed app on your phone with this technique, so it goes further than just having google maps enabled while debugging.
C:\Program Files\Java\jdk1.7.0_03\bin> keytool.exe -V -list -alias androiddebugk
ey -keystore "C:\Users\Dell.android\debug.keystore" -storepass android -keypass android
type this in CMD.this will give both sha-1 and md5 key..plz change path as per ur machine..!
Make sure that the release API key is in the google_maps_api.xml file under the release/res/values folder, since this is the one that will be used for the signed release apk.
Related
I develop locally with android-studio and a Galaxy S3 android phone connected via USB.
On my local development environment, when I fire up the run configuration to deploy on the S3, everything works fine - the map shows up just fine.
But when I deploy as signed APK to our server, and install via Internet (I am trying on another android phone to keep things clearly separated), the map tiles don't load, I see the Google sign to the lower left and the GPS location icon on the upper right corner.
I've seen a few related posts:
Android Google Maps application showing grey background instead of the map
which seems first a bit dated, second he uses eclipse (I am using android-studio), third - it didn't work for me.
Android - Google Maps Grey Screen on Signed APK
This guy didn't get any useful answers to his question....
The first step is to get the SHA1 value for the key that you used to sign the release version of your app using the keytool command line tool.
keytool -list -v -keystore ~/Keystore/key1.jks -storepass <your_store_password> -keypass <your_key_password>
Replace ~/Keystore/key1.jks with the path and name of the keystore that you used to sign your release version, and replace the passwords with your own.
When you execute this command at the command line, it will list the Certificate Fingerprints, including the SHA1 value that you need.
The next step is to add the SHA1 and package name to a key in the Google Developers Console.
You can either add it to the same key you used for debug builds, or you can create a new key.
To add your release SHA1 and package name to an existing API key, click the Add package name and fingerprint button, and add your SHA1 value and package name.
Then, you can use this API key with the signed release version of your app.
For more information on how to configure your app if you use a different API key for debug and release, see here.
Step 1: Follow the instructions from here:
http://developer.xamarin.com/guides/android/platform_features/maps_and_location/maps/obtaining_a_google_maps_api_key/
Step 2: Then from your Android Studio, follow the steps described here:
https://www.udacity.com/wiki/ud853/course_resources/creating-a-signed-apk
I faced a similar problem and had it solved by doing the above.
I'm trying to develop a Google Maps V2 based application with android studio on my mac computer. It is working fine while debugging. I've created a map and added a lot of markers, polygons and polylines on it. Looks great!
I'm using real device not an emulator. Real device connected to my computer via USB cable.
But, If I created an APK file with Android Studio and copy this APK file to real device, my application showing only gray tiles.
I've made too many searches but I couldn't find any solution.
Please help.
Problem solved. Thanks to HAR
My mistake was using wrong keystore file. When I use right myapp.jks file problem solved.
The key you obtained and entered in the api console is for debugging purposes. You have to obtain sha1 key for the apk file from the Keystore file which you are using to digitally sign the apk
Procedure for obtaining SHA1 key for release mode
1) Go to the location where you have your 'keystore' file which you are using for digitally signing your application.
2) Open command window in that location. This can be done by 'shift+rightClick' and selecting the option 'Open Command Window here'
3) Use the following Command
keytool –v –list –keystore <name> -alias <aliasname>
where name- your keystore filename
, aliasname - the alias name for the app
4) Then enter your keystore password
5) you will then get your sha1 keys along with other information. Use the key in the api console.
Use Keytool binary or exe to generate a private keystore. Instructions here. You can then sign your app using this keystore. Keytool gets installed when you install Java.
Test sign apk on your real device
I'm stuck in this issue, when i run my project in eclipse it shows map correct, but when i upload it to Google play store and when i install it in my device , it shows the blank map,
I don't know what is a problem my map key is correct, package name is correct, i also generate new map key and try, but it also doesn't work. I don't know where is the issue.
Please follow the check-list :
1) Sign the app with new .keystore.
2) SHA1 of new .keystore should be used.
3) Map key should be made using this SHA1.
4) If new Google account is used, then make sure Android Maps V2 services is turned on for that account.
As this type of issue was already raised and there was the solutions
Google Map Android API v2 can't display map in play store application
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.
Next time whenever you want new signed app just use this keystore no need to create new again.
Make sure you update the SHA-1 in the play store from the location
Select your App --> App Integrity --> App signing key certificate --> SHA-1 certificate fingerprint.
Paste it into Release Key along with the app package name.
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
Also look http://android-er.blogspot.in/2012/12/displaying-sha1-certificate-fingerprint.html for more information
In a project, when I install the app on a handset directly through the Eclipse IDE, I can see the Map functioning perfectly.
But if I send the apk to someone through email and they install it on the device, altough the app works they are not able to see the map but only a blank grid!
We already have the MapKey in the project. For a non-market app, how can I show the map if the app is not installed through the Eclipse IDE on my system?
Each api key is tied to that certificate. When you run a project in eclipse, it uses your debug keystore. When you export it, you most likely are using a different keystore, so your maps api key is no longer valid. Take the keystore you used to signed the exported apk and get a new api key. You'll need to swap the map api key back and forth when you are developing and releasing your app. Hope that helps.
"When you export it, you most likely are using a different keystore, so your maps api key is no longer valid."
Not fully correct, you can Export from Eclipse and then sign map with your key.
So full algorithm is:
1. Export with Eclipse
2. Create key - remember path (say mypath/myawesomeapp.key)
then open Terminal and goto to folder with key and type in terminal
keytool -list -keystore myawesomeappkey.key
And then you get Certificate fingerprint in page https://developers.google.com/android/maps-api-signup
Your Google Maps API key may not match the certificate you used to sign the application, since if you use different keys for signing development builds and release builds, you will need to obtain a separate Maps API key for each certificate.
Please, check this page to find out how to generate a proper API key for Google Maps API: https://developers.google.com/android/maps-api-signup
i am using android Google map, the map is displayed in emulator but not in the device.. can any one help me to solve the problem.
This is the problem of Wrong map key.
You have to find your debug.keystore file path and then you have to generate google map key.
In windows:
The debug.keystore is mostly found at :
C:\Users\UserName\.android\debug.keystore
Same is in ubuntu, means in home\user\username\.android\debug.keystore
For conveniency:
You can download the "Keytool plugin" in android to get the md5 fingerprint.
After getting md5 fingerprint, You can obtain the map key from here:
https://developers.google.com/android/maps-api-signup
I had the same problem before, the question is that when we compile the app and get the release apk, google actually thinks that the app is released, so we have to get a release key to use it on real devices, but for a while to keep testing and developing the app, we should use the debug apk. To use the debug apk just go to:
YourApplicationFolder\app\build\outputs\apk\app-debug.apk
After compile or running on emulator.
Make it as a signed application and uninstall the previous application, then install it again. This will work as I faced the same problem.
I think you have used the debug key(for generating the unique key).
Try to use release key instead.
Use the following command:
keytool -list -keystore fileName.keystore
on command prompt to generate the release key.
For more details see http://code.google.com/android/add-ons/google-apis/mapkey.html.
Hope this will work for you.