Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I import com.google.maps.android.SphericalUtil in Android Studio?

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.

like image 225
Manoj273 Avatar asked May 22 '15 11:05

Manoj273


3 Answers

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

like image 195
Amrit Pal Singh Avatar answered Nov 08 '22 14:11

Amrit Pal Singh


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

like image 44
antonio Avatar answered Nov 08 '22 13:11

antonio


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

like image 1
madwyatt Avatar answered Nov 08 '22 13:11

madwyatt