question

howardweate avatar image
howardweate asked

OnMapReadyCallback and MapFragment.getMapAsync() class and method missing?

I'm using Android Studio, migrating an app from GoogleMaps APIv2 to Amazon Maps APIv2. No matter what I try, com.amazon.geo.mapsv2.OnMapReadyCallback and MapFragment.getMapAsync() will not resolve and the compiler throws: Stacktrace: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; Compiler error: cannot find symbol class OnMapReadyCallback As per documentation I've: - installed Amazon Maps API v2 via SDK Manager - created Maven local repository and transferred .aar and .pom files - added Maven local repository as dependency in Project Structure Package build.gradle: allprojects { repositories { mavenCentral() mavenLocal() } } Module build.gradle: dependencies { compile 'com.amazon.android:amazon-maps-api:2.0' } - renamed all Google namespaces and classes to Amazon equivalents. As a result, I have access to the com.amazon.geo.mapsv2 package in my class. All fine: import com.amazon.geo.mapsv2.AmazonMap; import com.amazon.geo.mapsv2.AmazonMapOptions; import com.amazon.geo.mapsv2.MapFragment; import com.amazon.geo.mapsv2.CameraUpdateFactory; import com.amazon.geo.mapsv2.model.CameraPosition; import com.amazon.geo.mapsv2.model.LatLng; import com.amazon.geo.mapsv2.model.LatLngBounds; import com.amazon.geo.mapsv2.model.MarkerOptions; Won't resolve: import com.amazon.geo.mapsv2.OnMapReadyCallback; Won't resolve: mapFragmentInstance.getMapAsync(); Support failed to understand the issue - can anyone shed any light on this?
amazon maps
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Ross@Amazon avatar image
Ross@Amazon answered
First download the most recent version of the Amazon Mobile App SDK here: https://developer.amazon.com/public/resources/development-tools/sdk). Once you have extracted the Apps-SDK directory, navigate to Apps-SDK -> Android -> Maps -> 2.0 -> lib -> amazon-maps-api-v2_lib -> libs and add the jar files located in the libs directory to your project. When that is done add the following to your onCreate() method and build to verify that the methods you are trying to access are included with the Maps API: MapFragment mf = new MapFragment(); mf.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(AmazonMap amazonMap) { } });
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.