10

I have done with polygon on Google map, now I want to calculate the area of a drawn polygon by using SphericalUtil.computeArea(), but I am not able to import com.Google.maps.android.SphericalUtil.

I have added Google play services and also added

uses-library "android:name="com.Google.android.maps"

into the manifest.

i_saw_drones
  • 3,486
  • 1
  • 31
  • 50
Manoj273
  • 175
  • 1
  • 3
  • 10

3 Answers3

26

In Android Studio - You have to add following dependency to your Gradle build file:

dependencies {
    compile 'com.google.maps.android:android-maps-utils:0.6.2'
}

Reference - Google Maps Android API utility library

  • SphericalUtil class is available under android-maps-utils

See link here

tomrozb
  • 25,773
  • 31
  • 101
  • 122
Amrit Pal Singh
  • 7,116
  • 7
  • 40
  • 50
1

com.google.maps.android.SphericalUtil is included in the Google Maps Android API Utility Library, so you need to setup this library in order to import SphericalUtilin your project.

Here is the Google Maps Android API Utility Setup guide

antonio
  • 18,044
  • 4
  • 45
  • 61
1

This works to me:

dependencies {
...

   implementation 'com.google.maps.android:android-maps-utils:0.5'
   implementation 'com.google.android.gms:play-services-maps:15.0.1'

}

from https://developers.google.com/maps/documentation/android-sdk/utility/setup and https://developers.google.com/android/guides/setup

madwyatt
  • 344
  • 6
  • 12