Istiak Morsalin
Istiak Morsalin

Reputation: 11159

How to add Google Maps in Android studio

As there is no mapView in Android studio, I was trying to add Map Like this:

 <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

But it is showing rendering Problems. Please see the Image for Details..

enter image description here

Upvotes: 0

Views: 13426

Answers (2)

Vijay Prakash
Vijay Prakash

Reputation: 111

You can add layout like that.its working fine for me and select map activity instead of blank activity

Add the dependency in gradle 
{
compile 'com.google.android.gms:play-services:8.1.0'
}


<fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/spr_place_type"
        class="com.google.android.gms.maps.SupportMapFragment" />

Upvotes: 1

Belal Khan
Belal Khan

Reputation: 2119

Adding google maps to your app is very simple. Just create an activity and select maps activity and all the things will be automatically done by android studio. You only need to put your google maps api key. For more details you can check my blog where I written a tutorial about android google maps.

Upvotes: 1

Related Questions