I have use, fragment for maps. and also i have putted same API key in both debug and release google_maps_api.xml
but it works only on debug mode. in release mode maps fragment is shown as empty. how to fix this issue.
referring to https://developers.google.com/maps/documentation/android-api/signup
you will have 2 SHA keys ... one for debug, one for release.
just enter the SHA finger print for the release app into your console and it should work.
open your console using this link https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&reusekey=true
under credentials, enter the sha and your package names (see image below).
For my case, i use the same API key for two apps (and debug and release), hence there are 4 rows.
Pls. try this:
use adb to install the apk on your device/emulator (adb install app.apk). Don't forget to uninstall the debug version first, otherwise the signature difference will prevent the installation
Related
I've implemented Google Map in my application. Everything works correct in Debug version. But as soon I generate Release APK, Google Map is not working
I have done All process for (SHA-1 key and package), but I'm facing the same problem.
I have seen the "questions that may already have your answer", but I'm not satisfied with those answers.
Debug certificate is different from your production certificate. You need to add both to your Google Maps key entry in your API console as seaparate row - each with the same packageId, but naturally different SHA1 hash.
OR
Maybe you have two google_maps_api.xml files, one in the app/src/debug/res/values folder and the other in the app/src/release/res/values folder, but only the debug one contains your API key.
you can follow this steps to working google map in both debug and release mode
https://stackoverflow.com/a/17141660/8118033
I'm currently developing an application for Android and I'm using Google Maps API. In developer console, I added my SHA1 certificate print, followed by my package name.
Even though I put this SHA1 certificate print using keytool, I can't access to the maps.
I made lots of search, but every topics brought me to answers where error were in a wrong API Key in developer console.
But I took the right SHA1, the one of my certificate.
Thanks in advance !
My Map in release mode was showing but after I publish to Play Store it was not showing.
I had mentioned both debug and release certificate SHA-1 Key to Google Developer Console but map in release mode after downloading app from play store was still not showing.
Here' what was problem:
Google Play App Signing is enabled for this app
Goto Release Management -> App Signing -> and copy the SHA-1 certificate fingerprint from App signing certificate
Or
Release -> Setup -> App Integrity -> App Signing
Paste this newly copied SHA-1 fingerprint to Developer Console and map in release mode will show.
I had this same problem, it was super frustrating. What I ended up doing was taking the key I made using my release keystore and putting it in the google developers console. Then, added the following into the android manifest.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="KEY GOES HERE"/>
I'm sure you read the documentation on this, but make sure you follow the instructions for the release certificate to the dot.
https://developers.google.com/maps/documentation/android/signup
You could also follow the link that was generated for you in the google_maps_api.xml file. This automates the process of entering the key into the developer console. However, make sure you still add that meta data value into your manifest.
The file google_maps_api.xml has to be under res/debug/ and res/release. The editor only shows your current run configuration which is debug by default and is a bit misleading if you do not observe the (debug) note after the folder name. Copy the google_maps_api.xml into both folder and edit make sure they have the correct API keys ofr each build.
Android Studio also creates a TODO in the release folder for the google_maps_api xml file and lets you know of the required procedure before release. Also please do not change the key in manifest manually. When you switch to a release variant, the key is automatically updated in the manifest.
In any case do this,
Go to the link as mentioned by #Andrew Brook
Click "Get a key" and continue
Either create a new project or use an existing one
Specify the options and click the button
If you already had made one before, for let's say for debug, then go to Create a new api key
Image here
Add the required name, click on "Add package name and fingerprint"
Add your app's package name and SHA-1 key (generete it using keytool in java/jdk../bin/)
Image here
You get your "release" variant API key to be added in the google_maps_api.xml in the release folder.
You have to Enable the SHA key In Google Developer Console
so at 1st go to release Management get your app SHA key (1st one )
then Follow this link
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=(Your SHA KEY)%3B(YOUR PACKAGE NAME)
Now it Will Enable the API .
now update your app with the new key .
It will Work .
I have an application on the playstore that uses maps. Although it worked fine in debug, map doesn't appears in realease.
I did the following steps:
- activate maps v2 on google console
- get the API key
- paste the API key in my manifest
- export the apt file with eclipse tool to generate and sign
It's happen because your given SH1 fingerprint signature does not match with your app's SH1 . When you have get API Key from API console you enter the SH1;package_name_of_your_app this SH1 is not the exact SH1 for your APP. For this reason map is not showing.
This is happen for me also. If any thing need please ask me.
Edited Answer
You will get this type of thing
When exporting in Eclipse like that, you will see a SHA1 signature for the release app. Use that one to create a new key, and add it instead. Then continue, as usual. The problem is that you have to have different keys for release and debug. Not sure where exactly was this written, but this should be enough as a source I think.
I have a problem with Google Maps api v2 on my android app.
I have generated the key for the debug certificate and everything works fine, but I can't make it work with the release certificate.
I've generated the key and the alias with eclipse, then I took the SHA1 which eclipse shows at the end of the "Export signed application" process.
Then I generated the api key for android apps in my google api console using
SHA1;package name
But it doesn't work... it works only with the debug key generated in the same way, only using the sha1 of the debug certificate!
Please help me, otherwise I can't release my app
Check your manifest file, I guess you've forgotten to set your release map api key there while exporting with your release key?
Me too faced the same problem during releasing my app to google Play, when I used Google Maps V2 in my app. After succeeding the issue, I wrote a blog post regarding this you can have a look.
As everyone requested, I would say the answer in following steps
1) Sign up your app using eclipse adt
2) Note down the SHA1 finger print which will be displayed at console of your eclipse adt
3) Again go to google console and get API_KEY for your app by using above got SHA1 fingerprint
4) Replace the old API_KEY with the new API_KEY on to manifest.xml of your app
5) Again sign up your app. Your app is ready to be published. But keep in mind that once you published your app to google market, you should be able to release updates to your app by signing .apk using the keystore which you used earlier for release.
Hope this helps ...
There are two files google maps api.xml, one is the debug and release the other, then you should replace the key generated on google website console and enter this file, another outlet is inserted directly into the manifest.
All,
I have been banging my head over this one for a few weeks now. I got google maps v2 setup for debug following all of their directions. I got my debug key based on the debug.keystore and everything worked great.
I was then releasing my application to the Google Play Store and followed the instructions on how to generate my release key and I generated my Google API Key using the Sha1 of the release key as the instructions state.
I released my application to the store and everything works great. Here is the problem though, I can no longer get the maps to show up even when switching back to the debug API key.
Currently to debug I have been releasing a build to Beta, waiting 3 hours, and then fixing accordingly. Luckily my map work has stabilized on this application but I would still like to understand what is going on.
Any ideas anyone?
I suggest that before you release to actually build apk in production mode then do adb install to your device. I try it and see if it works. At least it guarantee working before putting it up
Make sure that the map key id you use in the manifest is for release mode not debug mode.
Just before exporting the app as apk, replace the Google Maps debug key with release key. It worked for me.
Debug certificate: The Android SDK tools generate this certificate automatically when you do a "debug" build from the command line, or when you build and run a project from Eclipse without exporting it as a released application. The certificate is only for use with an application that you're testing; you can't publish an app that's signed with a debug certificate. The debug certificate is described in more detail in the section Signing in Debug Mode in the Android Developer Documentation. You can generate an API key from this certificate, but only use the key for testing, never for production.
Release certificate: The Android SDK tools generate this certificate when you do a "release" build with either ant program or Eclipse. You can also generate this certificate using the keytool program. This certificate can be used with an app you release to the world. Once you have the correct certificate for your needs, you can display its SHA-1 fingerprint using the keytool program.
More here: Google Maps Android API v2