MapView gone after publishing app in market. - android

I am using Google maps, my map view is working in debug mode and my last app uploaded is working fine, but when i export it with the release key and same keystore the map-view is not showing further, please help. I have tried with same keystore and new keystore.
i didn't found the solution.
I have mentioned i used these keys i got keys.
even new debug keystore, debug key from keytool and Api from google console

Open Command Promt
Goto your SDK location (for ex, c:\android-sdk\tools)
I:\keypath\my-release-key.keystore = it is your release key location which you use to sign your app
type below and press enter
keytool -v -list -keystore I:\Android\1_RELEASED_APP\0-key\my-release-key.keystore
it asks for key password type it and click enter,
then it generates and hash code
copy that code and
goto there
Generate your key with this hash code, and use it(MD5) your application which you will publish.

You need to obtain the API key for the signing certificate and replace it.
Obtain map key

There's a difference between the debug.keystore and release keystore. Your bold lines in your question state you generated new Debug Keys, which you should not do. Each time you update your app on the market, you should sign it with the same key as before; not generating new keys each time.
You need to get a signed API Key; which can be generated by using the same key you are signing your application with.
https://developers.google.com/maps/documentation/android/mapkey has some more info on it.
If you generate a new keystore key, you also need to generate a new Google Maps API Key as well.

You have two things to look for:
1> Your are using the same keystore to sign your application which you used to obtain google map keys.
2> You are signing your application from the same machine your signed earlier.
There should not be any problem if you have done these things.

Related

Why Google map Api key need to change frequently

I am facing an issue that I have created api key for google maps with debug and release key SHA like this :
And updated that key in my manifest
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBY34afkPU6TRw5v9yM1wqI3vFbk90zMt0" />
with all required permissions but after every few days google map looks blanks Like this :
After changing key in my manifest map is visible.
My question is why I need to change this API key after every few days?
If you use debug key and publish app, it will be blank. when checking export-> application-> map will be blank because you use debug keystore. To use production key, follow this step.
While signing app,ie in production, you want to use release key. For that you want to compare that with signed apk
Step 1:
Say for example your apk name is A and you are signing and creating a keystore for A.apk ie A.keystore will be created in some drive location.Let's consider it in E drive.
step 2:
Now locate to jdk in C drive(Considering for windows and assigning C drive)
C:\Program Files\Java\jdk1.7.0\bin>keytool -list -v -keystore E:\A.keystore -alias A
So it will create SHA-1 finger print
copy and paste that in google map console, it wll generate a key.use it in maps.
You need to change because you might change development system or developer key.
default.keystore will change on format system or change the system.
To solve this issue.
Make keystore and every time sign with the keystore and install in device.
So you will not get to change API key frequently.

Android: Google Map v2 not showing map for release apk

My google map app works fine on device with debug google map API KEY but when I create signed apk for my app with release google map API KEY, it does not display map.
To generate release mode google API KEY , i am using SHA1 fingerprint with my keystore.
And i am also defining "signing and build types" in my project Settings as explained by developer.android.com(http://developer.android.com/tools/publishing/app-signing.html).
Tried every possible solution(removing apk and than reinstalling it again, restarting the device, cleaning the project ). nothing worked.
Anybody have a good solution to my problem please help.
FYI Using android studios platform.
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.
The API key needs to be hardcoded into the Android Manifest, and it doesn't work if it's in a separate resources XML file.
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.
EDIT
There's no limit of how many certificate fingerprints and package names are assigned to single Google Maps key, so unless you need this separated is's perfectly fine to have both development and production builds using the same key. In google console it would be like this (one sha1 is from debug cert, which is the same for all apps you build using this IDE, other is production cert):
83:10:58:52:EF:3B:59:70:2B:28:9E:AE:4F:5E:1D:F0:7E:19:FB:F1;com.foo.bar
AE:4F:5E:1D:F0:7E:19:FB:83:10:58:52:EF:3B:59:70:2B:28:9E:AA;com.foo.bar
or even (but I do not recommend using same key for different apps):
83:10:58:52:EF:3B:59:70:2B:28:9E:AE:4F:5E:1D:F0:7E:19:FB:F1;com.foobar.myapp
AE:4F:5E:1D:F0:7E:19:FB:83:10:58:52:EF:3B:59:70:2B:28:9E:AA;com.foo.bar
EF:3B:59:7E:19:FB:83:10:58:57:AE:4F:5E:1D:F0:2B:28:DE:9E:01;net.something.otherapp
I had this Problem and running these steps I think this way is perfect and complete
For Android Studio:
Build-Generate Signed APK
Copy Key Store Path.
Now open a command prompt and go to C:\Program Files\Java\jdk1.6.0_39\bin> (or any installed jdk version).
Type keytool -list -v -keystore and then paste your Key Store Path (e.g. C:\Program Files\Java\jdk1.6.0_39\bin>keytool -list -v -keystore "E:\My Projects \Android\android studio\signed apks\Hello World\HelloWorld.jks").
Now it will Ask Key Store Password, provide yours and press Enter to get your SHA1 and MD5 Certificate keys.
You Can See SHA1 For Your Debug Certificate and Use in Developer Google
Console
Sorry for replying late. Hope this helps for future.
I use this solution to solve same problem
When we are using Google maps while developing, a default debug.keystore is used which has no password. When we build apk file to upload on Play store new SHA-1 key is made so we have to make new debug.keystore for that. We have to create new API key for that SHA-1.
According to solution How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android? we can get SHA-1 for the exported apk file .
After that use that new API key in Android Manifest as the previous one and you are done.
EDIT 1-
Steps to do this
1) Create apk file using "Use the export Wizard" in "Android Manifest" file of your project.
2) After inserting key and before finishing, MD5 and SHA1 keys are shown as shown is this given pic- (http://i.stack.imgur.com/SldEv.png)
3) Create new API Key for Android project in https://console.developers.google.com for new SHA1 which is retrieved in point 2).
4)Use that API key in manifest file as shown below
5)Clean your project and build APK file again as per point 1).
6) You can see google maps now in that apk.
There are two things to remember and get this working.
Debug Build Variant
Generate a new android debug key using the keytool
Associate this key (SHA-1) with the android map api key on google console
The debug mode has a google_maps_api.xml where the android maps api key is stored (src/debug/.../google_maps_api.xml) as a string "google_maps_key"
Release Build Variant
Generate a new android release key using the keytool
Assoiciate this key (SHA-1) with a new android map api key on google console
The release mode has a google_maps_api.xml where the release android maps api key is stored (src/release/.../google_maps_api.xml) as a string "google_maps_key".
In the AndroidManifest.xml add the following line :
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
Follow the normal procedure for debug and release. It should work seamlessly.
create another Maps API key (to put in your manifest) corresponding with you release
keystore for release.
check Google's documentation
you cannot use same key that you used in debug in the release, they have different works.
to solve this problem you have to generate new Google map key API KEY form the key store that you are using in you release copy
see this video for more details
https://www.youtube.com/watch?v=xLJ0jDFdUZ0
for futures refs ---my case--- there are two google_maps_api.xml files where you need to put your google api key. You can very easily do the mistake to replace YOUR_API_KEY in only one of them (especially if you just deleted the google api/app and created new ones)
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 :)
I had a similar issue and the problem was that I generated the apk from Android Studio without first selecting the right flavour. This means my manifest was still using the Google Maps API key that I created for the debug flavour.
Please make sure you select the release flavour in your Android Studio. See screenshot below:
How do I get the release api SHA1 fingerprint:
install your signed APK, from Playstore, or just copying it to the phone.
Plug USB cable if it is a real phone, and open Android Studio.
The first time you try to get maps, a Log entry will show something like:
E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIzaS<YOUR KEY YOUR KEY YOUR KEY YOUR KEY>
Android Application (<cert_fingerprint>;<package_name>): 56:AF:B2:<THIS IS WHAT YOU ARE LOOKING FOR>;br.com.tinx.<your package>
then, just follow those instructions, creating a new entry in the Developer Console.
if you hit your app maps prior seeing the log, you may need to close app from memory and try again)
this procedure should work on an emulator too.
If you are created SHA1 code from custom keystore use the same in release mode. or generate apk by signing with that same keystore and test.
Before that you need clear app data (Setting->App-select app-Clear data->uninstall) and try. this worked for me.
Ensure that package name is same as that in google developer console.
I had a similar problem: after creating a couple of new variants builds with same type ("release") but some new flavors ("free" and "premium"), the Google Maps fragment did not show anymore the maps and the screen appeared totally blank. In the logcat I could only see next error message "Unexpected response code 400 for https://clients4.google.com/glm/mmap/api" that probably was indicating some problem with the Google Maps API access.
Of course I reviewed again all the Google Cloud API process in order to check if something was missing in my API key credentials, but I did not find anything wrong. In fact, for new APK's it is indicated to add the builds info (name+fingerprint) to the existing Project Credentials in order to inherit the same API key that is still valid.
The instructions that we can read are very clear: "Add your package name and SHA-1 signing-certificate fingerprint to restrict usage to your Android apps. Get the package name from your AndroidManifest.xml file. Then use the following command to get the fingerprint: keytool -list -v -keystore mystore.keystore".
The problem in my case was that my new variants "package names" were not the one existing in the Manifest package name ("com.example.app_name.release"). In fact, due to my new flavors I had the same Manifest name BUT two new "real" package names: "com.example.app_name.free.release" and "com.example.app_name.premium.release". Those names do not appear written in the Manifest file as such as they correspond to the Gradle configuration where flavors are defined (in my case with "applicationIdSuffix" attribute). This is quite confusing for me as Gradle "application id" should not overlap the Manifest "package name". But when we read carefully all the Android documentation, we can read "if manifest package name is different than Gradle applicationId, build will copy the application ID in final manifest file". Of course, both variants have the same fingerprint as both are still of the same build type ("release").
So the solution was to add in the same Project Credentials the two new variant entries to inherit the same API key:
original entry (don't need to delete it): Package name = "com.example.app_name.release" - SHA-1 certificate fingerprint = "xxxxx"
new entry 1: Package name = "com.example.app_name.free.release" - SHA-1 certificate fingerprint = "xxxxx" no change, same as used until now
new entry 2: Package name = "com.example.app_name.premium.release" - SHA-1 certificate fingerprint = "xxxxx" no change, same as used until now
Finally, it may be needed to clean your build in order to ensure that you are really watching the correct updated behavior in your maps fragment or activity.
About the rest of recommendations, in my case I did not have to apply them:
- no need to hardcode the API key in the Manifest
- no need to create a new API key for the new variants APK's
- no need to use the google_maps_api.xml files
Below method worked for me:
Put google maps api key in manifest as hardcoded text mentioned by #Florence Herrou
Android Studio creates inside:
app\src\debug\res\values\google_maps_api.xml (debug) //add key here
Add key inside ->
app\src\release\res\values\google_maps_api.xml (release) //add key here
Google key has two types of Security.
1.Non restricted key
2.Restricted key (Android restricted through SHA-1)
Note: Use Restricted key for Maps,Places, but not for Google Directions. use Non restricted api key for google Directions . bcz its web based api response so restricted key doesnt work.
-> When using Non Restricted key
look into 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. make sure key is same in both files.
-> When usingRestricted (Android SHA-1) key
Step - 1 : look into 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. make sure key is same in both files.
Step - 2 : Generate SHA-1 using AndroidStudio (gradle tab in Left Pane and select signing Report) and add as a item in google Developer console for the Api key which your using.
Step - 3: As soon as you generated Signed Apk google will overwrite your Androidstudio generated SHA-1 a with google own SHA-1 key. so u need to get tht also to be added for Api key in Api key in Developer console
Goto Release Management -> App Signing -> and copy the SHA-1 certificate fingerprint from App signing certificate
Paste this newly copied SHA-1 fingerprint to Developer Console and map in release mode will show.
Step 4: Add Release build SHA-1 also to Api key in Developer console like below.
Goto Release Management -> App Signing -> and copy the SHA-1 certificate fingerprint from Upload certificate
Paste this newly copied SHA-1 fingerprint to Developer Console and map in release mode will show.

Sign Android App contains Google Maps

I created one small app in which I used Google Maps API v2.
For testing and debugging, I used the default debug keystore that is generated named as debug.keystore.
I generated my SHA key that has to be provided for using maps and generated api key and used in my application. I signed the application using EXPORT wizard in eclipse and am creating my new key store for my app and generating application apk.
But now when I am trying to run this app on device the MAP is not displayed.
As I suspect this is due to new keystore for my app and i have registered my debug keystore SHA key to google console.
What am i doing wrong here and how can i fix it?
While signing an application with different keystore from debug one, you should create another API_KEY using SHA1 generated from your current keystore and register it in Google API Console and use that key for Google Maps. Your maps won't show up,because API_KEY is generated by the current keystore and your package name. Changing keystore file will cause your MapView to shows blank, because SHA1 is different.
So as a final answer, you should repeat all steps to generate an API_KEY for Google Maps with new SHA1.
Edit: There are two options which you can use to create SHA1 from keystore file.
keytool -list -v -keystore <path_to_your_keystore> will give you SHA1.
Using Eclipse if you try to sign your app with your keystore, at the end before saving your .apk file it will shows you SHA1 and MD5 generated from your keystore. I think it was the second time when you try to sign apk.

Map is not working after installing from play store in android

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

Expired Google Maps keystore certificate

When exporting my apk I've always used the temp.keystore I had and everything was ok - the Google Maps element was working as intended.
However the certificate expired (it was only 1 month, so that's understandable) and I couldn't export my apk anymore. Now even if I create a new keystore using a new API key or even a new debug.keystore (with a new SHA key) the Google Maps element is blank.
To sum up:
Google Maps worked fine
keystore certificate expired
can't export with the expired key
even with a new key the Google Maps element is blank
Is there something I'm doing wrong?
When you are developing app using google-maps-api, you can get sha1 with debug.keystore file. With this fingerprint, you can generate a new debug api-key which you can use on debug mode.
But if you will publish your app or export your signed app, you must use release api-key. How to generate this release api-key? It is simple. You should first sign your app and generate your private keystore file. With this keystore file you can get your sha1 fingerprint and then you can generate your release api-key with it. There is no time limit for this api-key. But there is a user limit if you use free google-maps-api.
In this way, i have published 2 apps and they are working well with their api-key.

Categories

Resources