I referred below mention instruction for generating API key
Get API Key
To use the Google Maps Android API, you must register your app project on the Google API Console and get a Google API key which you can add to your app.
Quick guide to getting a key
Step 1. Get an API key from the Google API Console
Click the button below, which guides you through the process of registering a project in the Google API Console, activates the Google Maps Android API automatically, and generates a generic, unrestricted API key.
GET A KEY
Notes:
Tip: During development and testing, you can register a project for testing purposes in the Google API Console and use a generic, unrestricted API key. When you are ready to move your app into production, register a separate project for production, create an Android-restricted API key, and add the key to your application.
Premium Plan customers: For production-ready apps, you must use an Android-restricted API key set up in the Google Maps APIs Premium Plan project created for you when you purchased the Premium Plan.
For more information, see the detailed guides below for Standard Plan and Premium Plan customers.
Step 2. Add the API key to your application
Follow the steps below to include the API key in your application's manifest, contained in the file AndroidManifest.xml.
In AndroidManifest.xml, add the following element as a child of the element, by inserting it just before the closing tag:
Substitute your API key for YOUR_API_KEY in the value attribute. This element sets the key com.google.android.geo.API_KEY to the value of your API key.
Save AndroidManifest.xml and re-build your application.
Note: As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception.
That's it. If you followed the above steps successfully, you've finished. If you ran into a problem, read the detailed instructions below for the standard API and the Premium Plan.
Detailed guides to getting an API key
Detailed guide for users of the standard Google Maps Android API
Follow these steps to get an API key:
Go to the Google API Console.
Create or select a project.
Click Continue to enable the Google Maps Android API.
On the Credentials page, get an API key.
Note: If you have an existing API key with Android restrictions, you may use that key.
From the dialog displaying the API key, select Restrict key to set an Android restriction on the API key.
In the Restrictions section, select Android apps, then enter your app's SHA-1 fingerprint and package name. For example:
BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75
com.example.android.mapexample
See more about API key restrictions below.
Click Save.
Error :
Attempt to invoke virtual method 'java.util.List app.movie.tutorial.com.model.MovieResponse.getResults()' on a null object reference