Thursday, July 28, 2016

How to use Google Map API in Android.

How to use Google Map API in Android.
1- you need to create Google API Key
Click on get Key and follow the process till you get the below screen showing Google API Key
2- Now create a certificate so that we can authenticate our request using belwo commands
keytool -list -v -alias androiddebugkey -keystore C:\xyz\.android\debug.keystore -storepass android -keypass android
3- Go to
if you had already created a project in that case it will direct it to you on below pages
Select service accounts from left tab and select your project and generate key id of both the projects.

4- Create an andorid project and select google Map Activity (we are using Android Studio)
5- Add your Google API key to the srting.xml file
6- Make sure to add latest gms:play-services i nandroid studio as shown below.
Go to File -> Project Structure
Select 'Project Settings'
Select 'Dependencies' Tab
Click '+' and select '1.Library Dependencies'
Search for :
Select the latest version and click 'OK'
7- Run the application
- If you get below error
application won't run unless you update google play service
make sure to follow belwo steps
SDK Manager => Extras => Google Play Services.

Note: Make sure you change your API_KEY inside both google_maps_api.xml and strings.xml
- If you get this error java.util.concurrent.ExecutionException:
add below line in build.gradle inside defaultConfig{}
multiDexEnabled true

No comments: