I know this has been asked several times before but I am not sure whether my fix is proper. I am using Google Maps in my app. The google map is not loading and I am getting error as,
E/Google Maps Android API﹕ Authorization failure
Ensure that the "Google Maps Android API v2" is enabled.
My manifest is having,
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
My gradle file is below,
dependencies {
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
}
EDIT:
My fragment,
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="100dp" />
This is my layout where I am using the fragment,
<RelativeLayout
android:id="@+id/map_area"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="0dp" />
<Button
android:id="@+id/map_button"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/map"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="View Map and Directions"
android:textColor="#ffffff"
android:textStyle="bold" />
</RelativeLayout>
I have gone through some of the below links but none of these seems to work,
After going through several links, I managed to make my Google Maps work on removing the key restrictions from the google console. Is this the correct solution? Can anyone help me in fixing the issue with the Google Maps?
NOTE: I already have my Google Maps API Enable in Console.