views:

3736

answers:

8

I am new to Android software development and new to this site. I am hoping someone might have some experience with the problem I am having.

I've been following the Hello, MapView tutorial in order to not only learn the Android framework, but also the Google Maps library. I've tried my best to implement things exactly as the tutorial has instructed. My problem is that the application does load in my emulator (or even on my phone for that matter), but the map tiles do not load.

Searching Google I found a post by someone else on another site having the same issue, but his/her problem was that the important elements added to the AndroidManifest.xml file were not in the right order. I double-checked this in mine, but everything seems to be right.

So, I am not sure what the issue is and was hoping others have seen this before. I can provide any snippets of code, if that would help.

Thank you.

+1  A: 

The tiles not loading is almost always a result of using an inaccurate API-key, i think. Have you checked yours?

Details: Obtaining a Maps API key

David Hedlund
I know my API-key is correct. But your response lead me to investigating the signing of my application. I manually went through the export process of taking my generated APK file and signing it with the key I used to get the API-key, installed the subsequent APK file, and that worked. So, I guess my next question is how I can have this process automated so that when I hit the Run button in Eclipse, it builds it, signs it, and installs it to the emulator?
Onyx
A: 

d. is probably correct. However, Internet problems will also cause similar symptoms. Be sure that your INTERNET permission is properly positioned and that there are no proxy servers/firewalls impeding access to the Internet.

CommonsWare
See my comment under d.'s post.
Onyx
+6  A: 

Non-loading tiles are usually the result of not having the API key set up correctly. Obtaining a Maps API key

To answer the response you left to d.: If you want to have it "just work" when you run from Eclipse you'll need to get an API key for your debug certificate. There's instructions on the same page as before. Do note that you'll have to swap back to your other key before publishing though.

fiXedd
Thanks fiXedd. That's exactly what I needed.
Onyx
No problem... :)
fiXedd
+1  A: 

I am guessing the issue is not that you have an incorrect map key, but that you do not have the proper keystore setup. The application needs to be signed by the same keystore you used to generate the map key. You've noted that you can get it to work when you sign the application yourself, but you need to setup a debug keystore in order to use the Maps API with regular Eclipse builds.

All Eclipse builds require a debug keystore; you just normally don't notice it because ADT generates one for you automatically. You should either follow the directions here and create your own debug keystore, or you should take the debug key that ADT automatically created for you (it'll show you where it created it in Windows > Preferences > Android > Build) and sign up for another Maps API key. That key will work with Eclipse.

(P.S., this does make it a hassle to compile for release, as you need to switch your key back and forth depending on the signing keystore.)

Daniel Lew
Thanks Daniel. Yeah, that was exactly my problem, as fiXedd also pointed out. I've got my debug key setup now and the Google tiles/data is coming through. Thanks again, for your response and time.
Onyx
So is there nice way to handle this or do you have to switch keys each time before you do a release build?
Roaders
A: 

Make sure you have 3g on the top panel. If you don't then there is no internet connection. Sometimes I have to turn the emulator on and off a couple of times to get 3g to come up.

0l33l
A: 

Another problem could be a proxy that you are behind. The proxy slows things down a lot and it will effect your app even though the maps app and internet browser in the emulator work fine.

Prachi
+1  A: 

I had the issue of tiles not loading as well. As you mentioned your original post, one possibility is with the ordering of elements in the AndroidManifest.xml file. Specifically, I originally had the line:

<uses-permission android:name="android.permission.INTERNET" />

after the application element. Once I moved this line before the application element, my map tiles started loading again.

Alan LaMielle
A: 

Make sure that the keytool program is in your path. ADT will not be able to sign your applications unless this is in the path.

John Atwood