5

I'm using a SupportMapFragment with complete success. I'm not having any problems at all.

However I'm getting an error during my app's runtime. I'm running on a Gingerbread Phone and it has the latest GooglePlay. Also note that I'm using SupportMapFragment and the other support classes in order to cater to pre-Honeycomb.

Could not find class 'maps.j.k', referenced from method maps.y.ae.a`

The error occurs as soon as I inflate my view.

inflater.inflate(R.layout.fragment_map, container, false);

My layout file (fragment_map.xml):

<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1" />

Stack trace (at the moment of error):

Thread [<1> main] (Suspended)   
<VM does not provide monitor information>   
PhoneLayoutInflater(LayoutInflater).inflate(int, ViewGroup, boolean) line: 322  
MapsFragment.onCreateView(LayoutInflater, ViewGroup, Bundle) line: 90   
MapsFragment(Fragment).performCreateView(LayoutInflater, ViewGroup, Bundle) line: 1460  
FragmentManagerImpl.moveToState(Fragment, int, int, int, boolean) line: 911 
FragmentManagerImpl.moveToState(int, int, int, boolean) line: 1088  
BackStackRecord.run() line: 682 
FragmentManagerImpl.execPendingActions() line: 1444 
FragmentManagerImpl$1.run() line: 429   
FragmentActivity$1(Handler).handleCallback(Message) line: 587   
FragmentActivity$1(Handler).dispatchMessage(Message) line: 92   
Looper.loop() line: 150 
ActivityThread.main(String[]) line: 4277    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 507  
ZygoteInit$MethodAndArgsCaller.run() line: 839  
ZygoteInit.main(String[]) line: 597 
NativeStart.main(String[]) line: not available [native method]

My Fragment class (contains the SupportMapFragment)

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View v = inflater.inflate(R.layout.fragment_maps, container, false);
    return v;
}

I have all the required permissions in my manifest as described here.

It's not causing any problems, but I'm curious about what it means. I haven't found any answers

Rowan Freeman
  • 15,724
  • 11
  • 69
  • 100
  • 3
    Proguard may be the issue - you may be over obfuscating the code. – A--C Feb 12 '13 at 00:54
  • Hmm, but in my project.properties I have #proguard.config=... commented out. Doesn't that mean it's disabled? – Rowan Freeman Feb 12 '13 at 00:57
  • It should mean it's disabled, interesting issue. – A--C Feb 12 '13 at 01:01
  • Agreed. I wonder if it's my device. I would test with the emulator, but of course the emulator doesn't support many things; including GoogleMap. – Rowan Freeman Feb 12 '13 at 04:32
  • Can you post the code of your activity, manifest and the full stack trace of your logcat? It is quite difficult to assess using only these information. – Ariel Magbanua Feb 22 '13 at 00:15
  • OP here. Could this be caused by the SupportMapFragment being used inside another fragment? I have a class that extends Fragment and that is the class that is inflating the map and causing the error. To reiterate, it's not actually causing any known issues; but I'm curious what it means ;) – Rowan Freeman Feb 24 '13 at 23:07
  • I am having exactly the same problem even with the API examples provided by Google on a real device (although I can run the Google Maps app without any problem on it). Have you tried the API examples on the same device? – thelawnmowerman Feb 27 '13 at 00:37
  • @thelawnmowerman No I haven't. Are you using the Support Map Fragment? – Rowan Freeman Feb 27 '13 at 01:06
  • I found my problem: I was enabling the "Google Maps API v2" instead of the "Google Maps Android API v2" service at the Google APIs website. I made the change, and everything works fine now. – thelawnmowerman Feb 27 '13 at 01:07
  • Hmm that doesn't seem to be my issue. I've already done that and my maps work fine. Still this strange error though. – Rowan Freeman Mar 06 '13 at 02:59

3 Answers3

0

Here's a quick start guide on google maps api V2 using support fragment https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw

This might help you for trouble shooting Unable instantiate android.gms.maps.MapFragment

hope these helps. :-)

Community
  • 1
  • 1
Ariel Magbanua
  • 3,083
  • 7
  • 37
  • 48
0
android:name="com.google.android.gms.maps.SupportMapFragment"

replace with

class="com.google.android.gms.maps.SupportMapFragment"
nhahtdh
  • 55,989
  • 15
  • 126
  • 162
Arfan Mirza
  • 668
  • 1
  • 14
  • 24
  • No luck I'm afraid. I've also noticed that it only happens the first time the map is loaded. If you minimise the app or change activities etc then go back to the map the error is not raised. – Rowan Freeman Feb 25 '13 at 21:39
0

If you are overriding SupportMapfragment and creating your own fragment class, why are you using android:name="com.google.android.gms.maps.SupportMapFragment" in your activity xml.

Use com.your.package.your.supportmapfragment instead. You need to use class="com.google.android.gms.maps.SupportMapFragment"

Herks
  • 897
  • 9
  • 25
Nirav
  • 53
  • 6