0

I have been using the awesome android map extensions library in my application. I am doing a rewrite of the map / marker section and have attempted to updated the library to the 2.2 release from https://github.com/mg6maciej/android-maps-extensions, however, I am unable to include it as a library successfully (even after making it a library in properties). I am using Eclipse import, not the gradle version btw.

Reason is, I am using the getMap() and onMapReady() features of the updated Android V2 Gmaps.

Errors include (due to library no loading):

MapFragment cannot resolve to a type:

MapFragment mapFragment = (MapFragment) getFragmentManager()
                .findFragmentById(R.id.map);

GoogleMap cannot be resloved to a type:

public void onMapReady(GoogleMap map) {

When I use the standard google map imports, everything is just fine. The code is good, just cannot get the AME library to load.

How do you import the 2.2 update into eclipse?

EDIT>>> I am attempting to use Android Studio now... I have an error:

Caused by: java.lang.ClassCastException: com.google.android.gms.maps.SupportMapFragment cannot be cast to com.androidmapsextensions.SupportMapFragment

jasonflaherty
  • 1,924
  • 7
  • 40
  • 82
  • Hello Jason. How does your AME's project.properties look like? – MaciejGórski Jan 01 '15 at 10:04
  • @MaciejGórski besides the normal comment info: # Project target. target=android-8 android.library=true – jasonflaherty Jan 01 '15 at 14:57
  • AME requires a dependency on play services. Take a look at [project.properties](https://github.com/mg6maciej/android-maps-extensions/blob/c74e464eb3d26f85ebbbb9e62227809fede34581/android-maps-extensions/project.properties) that was there in version 2.1. I dropped support for Eclipse with 2.2. Maybe not the best decision. Did you also change src and res structure to the old ant defaults? If it was only about adding project.properties and the latest play services version source code, I'd be happy to add it back, but I don't want to revert from using src/main/java. – MaciejGórski Jan 01 '15 at 19:04
  • I included it with my project... Do i need to add it to ame also? I did not change anything else... Maybe i need to just jump into the gradle world ;) – jasonflaherty Jan 01 '15 at 19:40
  • Yes. Add play services as a library for AME, move src/main/java to src and src/main/res to res and it should work. About gradle: when I was switching to Android Studio one year and a half ago, I had a productivity drop and didn't like it, but after a month I already felt more productive. Now I would not want to go back. AS has so many useful features... I personally recommend a switch to anyone. – MaciejGórski Jan 01 '15 at 19:54
  • I started an AS 1.0.2 application and added AME as a dependency in gradle. All looks correct to me here now, however I am getting: Caused by: java.lang.ClassCastException: com.google.android.gms.maps.SupportMapFragment cannot be cast to com.androidmapsextensions.SupportMapFragment at com.jasonflaherty.snoteldata.MapsActivity.setUpMapIfNeeded(MapsActivity.java:144) at com.jasonflaherty.snoteldata.MapsActivity.onCreate(MapsActivity.java:69) – jasonflaherty Jan 02 '15 at 05:49
  • Looks like you didn't change full class name in XML. Remember to also change a call to `getExtendedMap` or `getExtendedMapAsync` on `GoogleMap`. – MaciejGórski Jan 02 '15 at 08:23
  • Add is working now @MaciejGórski! I really appreciate it. Android Studio will take some getting used to :) – jasonflaherty Jan 03 '15 at 07:07
  • Give it a few months and you will enjoy refactoring combos like (on Linux) Ctrl+Alt+V, Ctrl+Alt+M, Ctrl+Alt+N ;) – MaciejGórski Jan 03 '15 at 22:34

0 Answers0