Please Note – First, you need to enable Maps SDK for Android, Geocoding API, Geolocation API ,Distance Matrix API , Maps JavaScript API ,Maps Static API and Places API, then you need to enable Directions API. For enabling APIs, follow the same process as shown below for Directions API
Step 9 : Click on Enable
Step 10 : Click on Credentials
Step 11 : Click on Credentials in APIs & Services
Step 12 : Click on Create Credentials
Step 13 :Create Credentials dropdown menu will open, select API key
Step 14 : Click on Restrict Key
Step 15 : Select None in Application Restrictions, and then click on Save button
Step 16 : Here is your API key. Copy it
Step 17 : Now paste the copied API key