Problems with Map applications in eclipse

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Problems with Map applications in eclipse

Postby Lordsnoutimus » Sun Dec 13, 2009 11:45 pm

Hi,

I have this really annoying problem with Eclipse 3.5 (edit: its not just 3.5, this happens with every other version) at the moment. I'm currently developing an application which uses google maps and the map API, however, every time I try to import a map (import com.google.android.maps.MapActivity;) Eclipse just throws up an error "The import com.google cannot be resolved".

I've been downloading map examples to try and see if its my coding but every other application works (hello, world etc).

As a test, I've downloaded Ed Burnette's code examples from the book hello, android. Every example works apart from MyMaps, the one example I needed!

http://pragprog.com/titles/eband2/source_code

Any help would be great!

Thanks
Lordsnoutimus
Junior Developer
Junior Developer
 
Posts: 16
Joined: Sat Oct 17, 2009 10:05 am

Top

Postby Droid123 » Mon Dec 14, 2009 1:04 am

I had the very same problem a while back and it took me a while to resolve.

Here's the solution:

Make sure that you change the build target of your project to "Google APIs" + 1.5;1.6 or 2.0

How to:
RightMouseButton on your project in the Package explorer >> Properties >> Android >> click on the proper checkbox and save

cheers
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Postby Lordsnoutimus » Mon Dec 14, 2009 1:22 am

Thanks for the reply.

I have tried changing the API version from 1.1 to 2.0. 1.1 does fix the import error, however when I try to run the emulator it throws another error about a shared library not existing. I have it currently set on 1.5 as you can see from the image below.

This still does not work.

Image
Lordsnoutimus
Junior Developer
Junior Developer
 
Posts: 16
Joined: Sat Oct 17, 2009 10:05 am

Postby Droid123 » Mon Dec 14, 2009 1:34 am

hmm thats odd, mine looks like this:

(can't host my screenshot)

android 1.5 - android open source project - 1.5 - 3
android 1.6 - android open source project - 1.6 - 4
android 2.0 - android open source project - 2.0 - 5
Google APIs - Google inc. - 1.5 - 3
Google APIs - Google inc. - 1.6 - 4
Google APIs - Google inc. - 2.0 - 5


I'm guessing that you didn't install all the packages that came with the SDK. You can try to "Install new software" (in eclipse >> help >> install new software).
Enter this repository and see if you're missing some packages:
https://dl-ssl.google.com/android/repos ... sitory.xml

EDIT:
you can also use the "Android SDK and AVD Manager (in eclipse >> window) and then click on available packages.
In my manager it lists available updates but I'm not sure if I included the repository to it before, you should have a look and see if it's there already.
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Postby Lordsnoutimus » Mon Dec 14, 2009 1:39 am

Ah, now we are getting somewhere!

I have entered in that URL
https://dl-ssl.google.com/android/repos ... sitory.xml and also
http://dl-ssl.google.com/android/reposi ... sitory.xml

but I get an error saying "no software site found at https://dl-ssl.google.com/android/repos ... sitory.xml"

Is that the correct location?
Lordsnoutimus
Junior Developer
Junior Developer
 
Posts: 16
Joined: Sat Oct 17, 2009 10:05 am

Postby Droid123 » Mon Dec 14, 2009 1:41 am

Lordsnoutimus wrote:Ah, now we are getting somewhere!

I have entered in that URL
https://dl-ssl.google.com/android/repos ... sitory.xml and also
http://dl-ssl.google.com/android/reposi ... sitory.xml

but I get an error saying "no software site found at https://dl-ssl.google.com/android/repos ... sitory.xml"

Is that the correct location?


I'll have a look, have you already tried what I mentioned before after the EDIT tag?
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Top

Postby Droid123 » Mon Dec 14, 2009 1:46 am

ok i get the same error message.

Have a look at the Android SDK and AVD manager, it should at least list the installed packages. Does it include "Google APIs" ?

and does it list available packages?
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Postby Lordsnoutimus » Mon Dec 14, 2009 1:48 am

Thats it :) I have found the Google API's. When I was installing them from the SDK manager I did have the option to do so, however I did not see a difference between those and the typical android ones?.

Thanks so much for your help!
Lordsnoutimus
Junior Developer
Junior Developer
 
Posts: 16
Joined: Sat Oct 17, 2009 10:05 am

Postby Droid123 » Mon Dec 14, 2009 1:48 am

well guess the difference is the google proprietary api's like maps and stuff :)

Cheers!
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

getting the same error msg

Postby uncre8d1 » Tue Mar 16, 2010 3:52 am

I am getting the same 'com.google cannot be resolved' error. I have the Google APIs installed; The MapView example that I'm using as a reference ('NooYawk' from The Busy Coder's Guide to Android Development) works fine (on my phone, that is... won't run on the emulator, but the point is that it doesn't throw me errors). I can't figure out what I'm doing wrong... my project's API level is higher than that of the example, so that aspect should be fine, right?

Any help would be greatly appreciated... This is for a semester project and I'm starting to feel the pinch.

-uncre8d1
Normal?!? Man, I'd give my left arms to be normal.
User avatar
uncre8d1
Junior Developer
Junior Developer
 
Posts: 18
Joined: Tue Mar 16, 2010 3:41 am
Location: Silver Spring, MD

Re: getting the same error msg

Postby Droid123 » Tue Mar 16, 2010 10:04 am

uncre8d1 wrote:I am getting the same 'com.google cannot be resolved' error. I have the Google APIs installed; The MapView example that I'm using as a reference ('NooYawk' from The Busy Coder's Guide to Android Development) works fine (on my phone, that is... won't run on the emulator, but the point is that it doesn't throw me errors). I can't figure out what I'm doing wrong... my project's API level is higher than that of the example, so that aspect should be fine, right?

Any help would be greatly appreciated... This is for a semester project and I'm starting to feel the pinch.

-uncre8d1


Did you specify the Google API's library as the build target of your project?
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Postby uncre8d1 » Wed Mar 17, 2010 2:46 am

thanks. That was the problem, I guess. I thought that selecting 'android 2.0' with API lvl 5 was the same as selecting Google API 5. Oops. Thanks so much.
Normal?!? Man, I'd give my left arms to be normal.
User avatar
uncre8d1
Junior Developer
Junior Developer
 
Posts: 18
Joined: Tue Mar 16, 2010 3:41 am
Location: Silver Spring, MD

Missing Point class in maps.jar

Postby nicche » Thu Apr 08, 2010 10:31 am

Hi,
I've a similar problem while importing the com.google.android.maps.Point class ("The import com.google.android.maps.Point cannot be resolved").

As the Build Target of my project I'm using the Google APIs Target, platform 2.1, API level 7 (in Eclipse - Galileo).
From the SDK manager I see the following installed items:
- Android SDK Tools, revision 5
- SDK Platform 2.1, API 7, revision 1
- Google APIs by Google Inc., Android API 7, revision 1
(and nothing newer seems to be present in the available packages from http://dl-ssl.google.com/android/reposi ... sitory.xml)

From the Eclipse Package Explorer, if I explore the maps.jar file of the Google APIs, I can see a set of classes (inside com.google.android.maps) that does not include Point. It is the same package documented in http://code.google.com/intl/it-IT/andro ... -tree.html.
Am I pointing to an older version?

Thank you in advance
nicche
Freshman
Freshman
 
Posts: 8
Joined: Thu Apr 08, 2010 8:45 am

Postby nicche » Fri Apr 09, 2010 9:33 am

...OK, I realized that some examples in this site are based on old API versions.
nicche
Freshman
Freshman
 
Posts: 8
Joined: Thu Apr 08, 2010 8:45 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 1 guest