How do you rate this blog

Wednesday, October 5, 2011

Grey Tiles in Android Gmaps


Well I was trying out my first map app on android when I encountered a problem where in the map was not at all displayed, instead only grey tiles was being displayed. Well this can be really annoying as you really don’t know what has gone wrong even if you have written the code properly and it gets even worse if you are newbie like me. The following are the steps I used to solve this problem.

1) Check if the internet connection is working properly in your emulator, this can be done if you open the default maps application app in your emulator or doing a google search in the emulator. If your internet is not working properly then the google maps will not load, so you have to enable internet on your emulator using the following command
   "Emulator.exe  -avd <avd name> –dns-server http:\\<ipaddress>:8060  "
More options for emulator are mentioned in the following link - Android Emulator*

2) In androidmanifest.xml make sure you have used the following 
<uses-permission android:name="android.permission.INTERNET" />
because this tag provides the app rights to access internet on your  mobile.

3) If you have your own private key then see if you have a proper API key using your private key, if you want to generate a new private key use the following command
   keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000.
 If you are using eclipse you can create a new key using the create new option in Android Tools -> Sign application option.

4) If debug.keystore has expired, generally the validity of this will be 1 year. So if this debug.keystore has expired then delete this file located in the <home directory on your machine>/.android for windows. Eclipse will replace this new debug.keystore application. Now generate new MD5 key and use that to generate the new api key and use the new key in main.xml file.
Hopefully this post would have helped you fix the grey tile problem in your app.

1 comment: