0

In attempting to add a map to an Android app I encountered an error to the extent of:

04-15 17:36:42.036: E/AndroidRuntime(28534): java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment

I have read over numerous posts, and articles on what the problem might be and have tried any number of suggestions from:

  • verifying uses-library in Manifest
  • Adding the Google SDK (as opposed to the Android SDK).
  • Extending FragmentActivity (as opposed to Activity).
  • Setting up API Keys and adding them to the Manifest.

However, nothing changes the results. The app still crashes when trying to launch that activity, with the same error message.

In an attempt to narrow things down I downloaded the sample application from here, but it crashes with the exact same error message.

Being relatively new to Android, the above sample looked fine, but with it crashing it's hard to tell where the error is. The complete stack trace is can be found here.

I am developing this on a Nexus 4, running Android 4.2.

I would have assumed that the referenced sample app would have at least worked. Am I wrong? Is there something wrong with the sample I've been referencing?

Community
  • 1
  • 1
Jason Whitehorn
  • 13,585
  • 9
  • 54
  • 68
  • Can we see the xml file? Seems to be related to the error – Tim Apr 15 '13 at 23:13
  • @TimCastelijns, the full source can be found at the bottom of this post -> http://wptrafficanalyzer.in/blog/google-maps-in-android-application-with-new-google-maps-android-api-v2-using-supportmapfragment/ – Jason Whitehorn Apr 16 '13 at 03:57

1 Answers1

2

Have a look to my detailed step by step tutorial for using google android Map v2 on Android Virtual Device(Emulator) Android 4.2 http://umut.tekguc.info/en/content/google-android-map-v2-step-step

Specifically, make sure that the reference to google-play-services_lib can be resolved. If it cannot be resolved, the application will compile and launch successfully up to the point where it actually needs to display the map. Then it will crash.

  • Right click on the project in Eclipse, and select Properties.
  • On the left select "Android"
  • Ensure that google-play-services_lib has a green check mark next to it on the right under Library.

If it has a red "X" or is missing entirely, the reference will need to be re-added.

Jason Whitehorn
  • 13,585
  • 9
  • 54
  • 68
Umut Tekgüç
  • 551
  • 3
  • 2
  • Thank you for the reply. I'll dig into this in the morning and let you know what I discover. – Jason Whitehorn Apr 16 '13 at 03:58
  • That lead me in the right direction. It turned out to be I wasn't referencing `google-play-services_lib` and the sample was, but it couldn't find it. And, instead of a compiler error, it just borked during runtime. – Jason Whitehorn Apr 16 '13 at 13:48
  • Do you mind if I edit your answer to reflect my findings? That way, when I accept it, it'll be more obvious to future readers what the exact solution ways. – Jason Whitehorn Apr 16 '13 at 13:49