1

I have tried many times to solve the problem but always the same result .. empty map

This how my map looks like:

enter image description here

Could you please tell me where's my problem ?

Manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.artline.mycard">


<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
    android:protectionLevel="signature"/>
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <!--
         The API key for Google Maps-based APIs is defined as a string resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign the APK.
         You need a different API key for each encryption key, including the release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyCl47d0nxYgpEOGYqyMyDjbmalVszTb32g"/>

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" />
</application>

Build.gradle:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.android.support:support-v4:26.1.0'
   compile 'com.google.android.gms:play-services-maps:11.8.0'
}
moondaisy
  • 4,303
  • 6
  • 41
  • 70
Aqra Yosef
  • 21
  • 1
  • 3

5 Answers5

2

On top of adding your API key to your AndroidManifest.xml, be sure to add your app's package name and SHA-1 certificate fingerprint to said API key through the Google Developer Console.

Also, make sure you've the API enabled within the Google Developer Console.

See here for reference.

P Hall
  • 21
  • 1
1

Go to the Google console.

See the highlighted areas.

View properties API Google MAPS

Modify

Banghua Zhao
  • 1,518
  • 1
  • 14
  • 23
1

Step 1 Open Google Cloud Console

Step 2 Click Navigation menu

Step 3 APIs and services --> Enable APIs and services

Summary

Summary

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
0

Make sure your API key has created by your google account, you can refer this document to get API key: https://developers.google.com/maps/documentation/embed/get-api-key. (use Detailed guide to getting an API key part to create API key)

And your emulator must be installed google play service, you can refer this document: https://www.genymotion.com/help/desktop/faq/#google-play-services (I use genymotion) and log in register API key account in emulator

sorry because of my bad english!

yyater97
  • 1,697
  • 2
  • 9
  • 5
0

If you're very sure your configuration is OK including the API Key with its restrictions, checkout for the following things:

  1. Your account is active and billable.
  2. SSL Pinning on your app is off. If enabled, you will have to manually add Google Maps Server Certificate and hostname verifier

Hope it helps someone out there.

Makari Kevin
  • 111
  • 1
  • 4