Google maps not working once I did upgrade from google Maps v1 to google Maps v2

  • Replies:2
Anand
  • Forum posts: 2

Nov 18, 2014, 10:51:13 AM via Website

  1. When I am using Maps V2 as a standalone application, its working fine. But When I am using Maps V2 which is a sub activity of my project getting below mentioned error logs.
  2. My application works fine with Map v1 but I want to upgrade my application from Map V1 to V2

Added below mentioned code to call Map Activity : try { Class.forName("com.google.android.gms.maps.Support MapFragment");Intent n=new Intent(Information.this,Gmaps.class); n.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(n); }

Followed below steps to upgrade Google Maps v1 to v2

Added google-play-services.jar into my project.
Added library named_ google-play-services_lib found under the extras folder of my Android SDK setup folder to my Android project.
updated map.xml & Androidmanifiest.xml as per new version dependency

Error logs :

11-10 20:03:42.659: W/dalvikvm(9654): Unable to resolve superclass of Lcom/google/android/gms/maps/SupportMapFragment; (168)
11-10 20:03:42.659: W/dalvikvm(9654): Link of class 'Lcom/google/android/gms/maps/SupportMapFragment;' failed
11-10 20:03:42.659: W/System.err(9654): java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment
11-10 20:03:42.659: W/System.err(9654): at java.lang.Class.classForName(Native Method)
11-10 20:03:42.659: W/System.err(9654): at java.lang.Class.forName(Class.java:217)
11-10 20:03:42.659: W/System.err(9654): at java.lang.Class.forName(Class.java:172)

Reply
Kevin Berendsen
  • Forum posts: 118

Nov 18, 2014, 11:16:29 AM via Website

I recommend to include a fragment in your layout file of your map activity that uses support map fragment.

https://developers.google.com/maps/documentation/android/start#add_a_map

Take a close look there and instead of using mapfragment, use the support map fragment.

Anand

Reply
Anand
  • Forum posts: 2

Nov 18, 2014, 1:12:10 PM via Website

thanks a lot Kevin Berendsen for replying. But I already followed/explored above mentioned link while upgrading my android App map v1 to map v2 and I also included a fragment into my map layout file.

Actually Map activity is a sub activity for my android application thats why I am using below code snippet to access map
try {
Class.forName("com.google.android.gms.maps.SupportMapFragment");
Intent n=new Intent(MyMapActivity.this,GoogleMapsV2.class);
startActivity(n);
}

and At runtime I am getting below error logs :

11-10 20:03:42.659: W/dalvikvm(9654): Unable to resolve superclass of Lcom/google/android/gms/maps/SupportMapFragment; (168)
11-10 20:03:42.659: W/dalvikvm(9654): Link of class 'Lcom/google/android/gms/maps/SupportMapFragment;' failed
11-10 20:03:42.659: W/System.err(9654): java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment
11-10 20:03:42.659: W/System.err(9654): at java.lang.Class.classForName(Native Method)

I added below code snippet to my map activity class to check out whether its loading "com.google.android.gms.maps.SupportMapFragment" class or not

public static boolean isGoogleMapsV2Supported() {
try {
Class.forName("com.google.android.gms.maps.SupportMapFragment");
return true;
} catch (final Throwable e) {
}
return false;
}

But its returns False

I also tested "com.google.android.maps.MapActivity" class and it returns True

If you want to lookout my android sample application : check below link :

www.drive.google.com/folderview?id=0ByHh24AkXWSHbTlCTmppMkd3SGs&usp=sharing

— modified on Nov 19, 2014, 10:13:27 AM

Reply