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:
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 forcom.google.android.gms.maps.SupportMapFragment
to work: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.
Related Topics
Android - Drawable with Rounded Corners at the Top Only
Making Data Persistent in Android
Android: Using Linear Gradient as Background Looks Banded
Android: Scrolling an Imageview
Fragment Onresume() & Onpause() Is Not Called on Backstack
Set Limit on the Datepickerdialog in Android
How to Use Sharedpreferences in Xamarin.Android
Losing Data When Rotate Screen
Android Mediaplayer Stop and Play
Connect an Android Device to a Web Service on Local Host
How to Integrate Eclipse with Gradle in Android Project
How to Securely Store Credentials (Password) in Android Application
How to Convert Views to Bitmaps
How to Add a Library (Android-Support-V7-Appcompat) in Intellij Idea