1

after some work I was able to instantiate a MapView in a Fragment, I'm using the "Title stripes + swipe" layout, and my goal is to have one fragment with a listview, and the second one with a map.

I've read all the tutorials to have the new google map api workind, got the key and eveything should be settled up, but at execution time i got that error: Didn't find class "com.google.android.gms.maps.MapFragment" on path: /system/framework/come.google.android.jar:/data/app/my_package

The code is the one generated by the SDK ( the code generated by eclipse, chosing a title strip + swipe layout ) plus that inside the onCreateView() method:

View mFragmentView = inflater.inflate(R.layout.map, null);
MapView map = (MapView)mFragmentView.findViewById(R.id.map);
return map;

From the xml side, i have a map.xml layout with only that inside:

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/map"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  class="com.google.android.gms.maps.MapFragment"/>

Thanks in advance for your help

Anearion
  • 103
  • 1
  • 10

1 Answers1

0

There are several things that could be wrong.

You may have forgotten to include the proper jars on the build path, or are not referencing a library project correctly, or are missing google play services.

I'd check out this thread for a possible solution.

Unable instantiate android.gms.maps.MapFragment

Community
  • 1
  • 1
DiscDev
  • 38,652
  • 20
  • 117
  • 133
  • Ye, I'm not totally into that to be honest, but: -Yes, I have downloaded google play service -I have added the library on the project So i don't really know what could be, thanks for the link tho – Anearion Dec 17 '12 at 16:18
  • You made sure to add the library to the build path as well as to the libs folder, right (assuming you're using eclipse) – DiscDev Dec 17 '12 at 19:17
  • And you properly added the library project reference? http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject – DiscDev Dec 17 '12 at 19:22