Wednesday, December 19, 2012

Add reference library google-play-services.jar to project using MapFragment and SupportMapFragment

To use MapFragment or SupportMapFragment on your Android App, you have to add reference library google-play-services.jar to your project. Otherwise, ClassNotFoundException will be thrown caused by com.google.android.gms.maps.MapFragment or com.google.android.gms.maps.SupportMapFragment.

To add reference library google-play-services.jar:

- Right click on your project, select Properties.


- Select Android on the left selection, scroll down to the Library at right, and click Add.

- Select google-play-services_lib and click OK.

- Apply and click OK.


The series:
A simple example using Google Maps Android API v2, step by step.







Remark: Somebody report that ClassNotFOundException still happen even added reference library google-play-services.jar! Refer to comments in the post Using SupportMapFragment. So anybody have any other suggestion, please share in comments. Thanks.

Related:
- Tips to add Support Library


4 comments:

Nayanesh Gupte said...

Hello,
my colleague faced the same issue. but then while searching on internet i came across this
http://bon-app-etit.blogspot.be/2012/12/using-infowindowadapter-part-2.html
blog .
he is also using same lib as that of you but its working smoothly.
I'll try to ask him that from where did he downloaded lib.

Unknown said...

I does not work with Google Play services v6 (latest), you have to do it with v4. At least when using an Emulator.

kevin said...

Hey, I am referencing that library, but once I run the app on emulator the same ClassNotFoundException is found, and when I go back to my reference the library is marked with a "X"(red) and not a TICK(green)

Anonymous said...

In my google-play-services.jar there is a class called com.google.android.gms.maps.model.MarkerOptions in this class google docs docs says it has a method named flat
flat
which is missing in my jar

I wanted to know if same is missing in your jar file as well