-1

I am too much confused. My google map application works fine before signing the application. After signing the app the map not loaded and grey screen still showing. I search this problem whole day and apply every answer find in stack overflow and also other sites but failed to load the map. also apply this method: Signup and API Keys

please help me.

4 Answers4

1

You need to add SHA-1 of signed application on google console with your project package name.

For Android Studio:

Click on Build > Generate Signed APK.

You will get a message box, just click OK.

Now there will be another window just 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 (Eg. 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 Stroke Password, provide yours and press Enter to get your SHA1 and MD5 Certificate keys.

akshay
  • 5,811
  • 5
  • 39
  • 58
0

I faced similar problem, follow the instruction.

After you get the new SHA-1 key after signing the application, go to your google developer console.

There in your existing API key which you created, Edit the sha-1 key and save it, by this your api key will remain same.

After this DO NOT RUN THE APP AGAIN FROM YOUR ECLIPSE/ANDROID STUDIO IDE, as it will launch the app with old sha1-key

Install the signed apk in your device, by this your app will request google with the signed apk sha-1 key.

penta
  • 2,536
  • 4
  • 25
  • 50
  • then it definitely means ur sha key problem, definitely is, read my steps again, i had exact ditto same problem – penta Oct 04 '15 at 12:53
  • Logcat shows in debug mode.. It chnge my sha1 with debug mode (default sha1) and api key on my console is with my keystore sha1...how to check logs in release mode? – user3001551 Oct 04 '15 at 13:21
  • just plug your device, run the app(not from IDE) and see logs, you need to give the signed sha1 vesion in your google dev console(in the api section) – penta Oct 04 '15 at 13:23
  • Yes give signed sha but logcat shows the old one while the key is new in logcat... And logcat not show in release mode or only device is attached – user3001551 Oct 04 '15 at 13:24
  • do like this, after u sign ur app you get an option to export the apk right ? get that apk and install it in your device, and tell me if u get the map. Keep in mind that ur dev console should have the released app's sha key – penta Oct 04 '15 at 13:26
  • I generate keystore in android studio. using this keystore i generate SHA using cmd and set this sha in google console to generate api key then use this key in my project. after that i set my android studio to auto generate the release apk file. the attach my cell with adb set build variant to release and install app directly on cell.... map is not loading and there is no logcat when i select release build variant. – user3001551 Oct 04 '15 at 13:32
  • bro, did you get just the .apk file after doing generate signed apk ? – penta Oct 04 '15 at 13:35
  • yes i generate the signed apk build>generate signed apk using android studio. but how can i see logs of the apk in log cat? – user3001551 Oct 04 '15 at 13:41
  • i do not know why your logs are not coming, but just folow this now, now get your generate signed .apk and install it in you phone, remove all wire connections, just follow me, we will make it work – penta Oct 04 '15 at 13:43
  • I send signed apk using bluetooth and install it but map is not loading.. in logcat under my device name there is no debugable app... – user3001551 Oct 04 '15 at 13:49
  • ok, good, now go to your google dev console, and check if the sha-1 key is same as the one which you got after signing it – penta Oct 04 '15 at 13:50
  • after signing i have no sha1 i generate it using my keystore in CMD using keytool -list -v -keystore this method and set it in dev console... during signing the app i use same keystore file.. – user3001551 Oct 04 '15 at 13:53
  • ok see, after you signed you app you must have signed it by your_keystore_name and your_alias_name; now in your command prompt run keytool -list -v -keystore -alias with the required parameters, you will get the relased sha1 fingerprint – penta Oct 04 '15 at 14:00
  • yes i already done this all before signed the app.. in CMD i get sha1 which i use in dev console to generate api key – user3001551 Oct 04 '15 at 14:08
  • bro after u sign the app you will get different sha1 key – penta Oct 04 '15 at 14:09
  • here is the signed log....Ensure that the "Google Maps Android API v2" is enabled. Ensure that the following Android Key exists: API Key: YOUR_KEY_HERE – user3001551 Oct 04 '15 at 14:09
  • read this http://android-er.blogspot.in/2012/12/displaying-sha1-certificate-fingerprint.html, you will know what i am trying to tell – penta Oct 04 '15 at 14:10
  • it is impossible to get same signed sha key after doing signed version – penta Oct 04 '15 at 14:11
  • if this is possible then what is the problem? I generate sha before signing the app and then signed the app with the same keystore...i there some thing wrong? i have keystore in different directory and app source in different directory... – user3001551 Oct 04 '15 at 14:14
  • bro, it is no way possible that your debug and release app will have same sha key, you probably will be getting a blank google map with google logo in left bottom, your app has got a different sha key, I am 100% sure – penta Oct 04 '15 at 14:16
  • But i also tried the sha that is generated my keystore and the same keystore i used when signing the app... then what is the problem now.. logcat why not show the api key.. – user3001551 Oct 04 '15 at 14:27
  • upload your code to bitbucket or github and send me the link, il check it or send it to androidappsnexus@gmail.com, il check it – penta Oct 04 '15 at 14:30
  • can you tell me.. the name of keystore can be different with the name of app?? or any other name need to match? – user3001551 Oct 04 '15 at 14:37
  • the name of the keystore will be given by you, it is not name of the app, you give name of the keystore while signing it – penta Oct 04 '15 at 14:37
  • i try to add .keystore extension with my keystore but it says file not exist then i use it without this extension..is there anything wrong ? – user3001551 Oct 04 '15 at 14:44
  • your steps are wrong. read the steps http://android-er.blogspot.in/2012/12/displaying-sha1-certificate-fingerprint.html very very carefully, just read it once, your answer is here – penta Oct 04 '15 at 14:46
  • which api key insert in my code before the signing ? – user3001551 Oct 04 '15 at 14:48
  • the api key you get before signing is default key, you need to get release key, please read the blog link which i gave you in comments – penta Oct 04 '15 at 14:50
  • which key are u talkng about ? release or debug or api ? – penta Oct 04 '15 at 14:53
  • bro, after you get api key, you dont have to set it again in manifest, you just need to update the release sha1 key in the google dev console – penta Oct 04 '15 at 14:55
  • bro, this chat is becomming too long, please try it by yourself – penta Oct 04 '15 at 15:03
  • 1
    Solved..... I get key from Dev Console by enter both SHA (debug and release) same key is generated for both.. I put this key directly into my manifest file not using @string.. – user3001551 Oct 05 '15 at 10:51
  • How were you able to get the release sha key ? – penta Oct 05 '15 at 11:08
  • WHY WERE you not able to do that before ? – penta Oct 05 '15 at 11:11
0

it is because your SHA-1 code generated as Debug key Debug key:

keytool -list -v -keystore c:\users\your_user_name\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android

you have to get SHA-1 for you sign key :

keytool -list -v -keystore {keystore_name} -alias {alias_name}
keytool -list -v -keystore  D:\Android\signkey\prj_name_SignKey\prj_name.jks -alias myalias

Do Not Use Spaces for alias and directories. it gives you different SHA-1 but your Google API_KEY doesn't changes it's so Simple Good Luck

Hossein Kurd
  • 3,184
  • 3
  • 41
  • 71
  • you get new SHA-1 and use it in Google console, Don't You ? – Hossein Kurd Oct 04 '15 at 11:52
  • Yes i do... But map not loading – user3001551 Oct 04 '15 at 12:05
  • Logcat shows authentication failed... Is the api key exist.... Yes api key is correct and generating using keystore file's sha1 key.. Same keystore is used for signing the app.... – user3001551 Oct 04 '15 at 16:35
  • Use correct API_KEY, you can reach it from Google's Console Panel, copy that into NotePad and Make Sure no incorrect characters attached – Hossein Kurd Oct 05 '15 at 06:53
  • please get new API_KEY and launch app again, also please copy LogCat – Hossein Kurd Oct 05 '15 at 09:46
  • Sending API token request. 10-05 14:58:44.800 9919-10765/com.locationreminder.azmizryk.locationreminder E/b﹕ Authentication failed on the server. 10-05 14:58:44.800 9919-10765/com.locationreminder.azmizryk.locationreminder E/Google Maps Android API﹕ Authorization failure. Ensure that the "Google Maps Android API v2" is enabled. Ensure that the following Android Key exists: API Key: YOUR_KEY_HERE Android Application (;): E8:A3:***********C2;com.locationreminder.azmizryk.locationreminder – user3001551 Oct 05 '15 at 10:01
  • did you enable "Google Maps Android API v2" From Google Console's panel ? check it please – Hossein Kurd Oct 05 '15 at 10:06
  • Yes i also make new project and enable it. – user3001551 Oct 05 '15 at 10:19
  • if you enabled the only reason is : your API_KEY is incorrect. if you think any thing is correct please upload sample to check – Hossein Kurd Oct 05 '15 at 10:49
  • Solved..... I get key from Dev Console by enter both SHA (debug and release) same key is generated for both.. I put this key directly into my manifest file not using @string.. – user3001551 Oct 05 '15 at 10:51
  • Well Done , Hope you improve to Advance . – Hossein Kurd Oct 05 '15 at 11:07
0

you are using old version of sha1. you need to again generate SHA1 using command prompt after making you apk signed.Steps to regenerate SHA1 is go to cmd and give the command like below: C:\Program Files\Java\jre1.8.0_91\bin>keytool -list -v -keystore "C:\Your key store path\keystores\android.jks"

go to your java in program file open java version like jre1.8.0 open bin folder and run command like above follwed by your key store path that you have generated when you generated the signed apk

Syed Danish Haider
  • 1,334
  • 11
  • 15