Error Java.Lang.Classnotfoundexception: Com.Google.Android.Gms.Maps.Mapfragment in Google Map V2

Error java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment in Google Map V2

You problem is the way you added google-play-services to your project:

I have copied the google-play-services.jar in libs folder and set in the build path of eclipse.

This is wrong!
Read the first 3 steps of this blog post I wrote to get an idea of how to do it correctly:

Google Maps API V2

In short, you should import google-play-services as a project in your workspace.
and then reference it from your project.

this should be the result:

Sample Image

Inflating SupportMapFragment with Google Maps v2 causes ClassNotFoundException

In MapsActitity.java Add this import ( import android.support.v4.app.FragmentActivity; )

Change

 public class MapsActivity extends Activity

To

public class MapsActivity extends FragmentActivity

Read this http://developer.android.com/training/basics/fragments/creating.html

Could Not Find Class com.google.android.gms.maps.SupportMapFragment

  • I do not see you mention adding the Android support library android-support-v4.jar. You need to make sure Eclipse is properly including it for com.google.android.gms.maps.SupportMapFragment to work:

    Eclipse Android project included libraries path

  • Another potential issue is mismatch of play services library in your app and the play services verion on your nexus 5 device. If you downloaded the latest library from SDK manager, it may be higher version than the one on your device. I am guessing your play services version on device is 5.0.89, you can check on device Settings -> Apps -> Downloaded -> Google Play Services. Try using older version of the library if that's the case.

Finding Google Play Services version



Related Topics



Leave a reply



Submit