1

I am coding Google maps v2 into my app but have run into an error. I have already included the API key in the manifest.

Whenever I click on "Map" from the list on the menu for my app the application crashes: Below is the errors shown in LogCat:

E/AndroidRuntime(2041): FATAL EXCEPTION: main
E/AndroidRuntime(2041): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.anonymous.anonymous1/com.anonymous.anonymous1.Activity_Map}: android.view.InflateException: Binary XML file line #3: Error inflating class fragment

This is the relevant Java and xml file: http://pastebin.com/LkjrHkPy

Does anyone know how to resolve this error so i can see the map on my application? I think it may have something to do with the xml containing a fragment.

Thank you for your time!

3
  • Can you post the full stack trace? If you're using an emulator, is it running the Google APIs? Commented Dec 17, 2012 at 18:58
  • @Nachi You mean this? pastebin.com/zeSj0JK6 I am using a nexus device, not an emulator Commented Dec 17, 2012 at 19:05
  • Yep, your real error is java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment". This might help. Commented Dec 17, 2012 at 19:11

1 Answer 1

2

Based upon the ClassNotFoundException, you need to add the Android library project for the Google Play Services to your app: http://developer.android.com/google/play-services/setup.html

Sign up to request clarification or add additional context in comments.

2 Comments

I have imported the google play services but it doesn't work since I already have a MainActivity
@user1892991: Your stack trace does not refer to MainActivity. You can tell this by searching your stack trace for MainActivity and not finding it. Also, the Google Play Services library project does not have a MainActivity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.