Setup Android Studio for Google Map Application

Setup Android Studio for Google Map Application

  1. In Android Studio create a New Project-> Give a name of Project
  2. Under Target Android Devices choose API 21 or lower
  3. Under Add an Activity to Mobile choose Google Maps Activity
  4. Open Project goto values -> google_maps_api.xml -> you see a xml tags as below, you need to create a google key and replace with string
    <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">string</string>

    Above string tag just click on the url to create a google key https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=52:A1:AD:AC:84:4E:63:7D:5D:E6:E6:F1:74:9A:13:32:A8:EE:B6:C0%3Bcom.xevcode.firstapp

  5. In Sdk Manager under Tool -> Andriod -> Sdk Manager -> Standalone Manager — make sure u select Google Services and Google Repository, SDK Platform to be installed
  6. Run the emulator -> under Tool -> Andriod -> Virtual Device Manager -> Create Virtual Device -> choose Nexus 5 -> use API 21, you should see a emulator like a mobile running otherwise you need to setup up emulator properly
  7. Under MapActivity.java
    void onMapReady(GoogleMap googleMap)

    u can change the coordinates just to see if the emulator will pick this up – to confirm it is working

  8. Note: In Virtual Device Manager API 22 and API 23 emulator could not work. It keep giving a error have to update google services. API 21 seem to work okey,
  9. Run the application and you should see google map on the emulator

Leave a Reply

Your email address will not be published. Required fields are marked *