If you are using an AVD emulator, you must first make sure that your emulator images are up to date.
To do that, open up your SDK Manager (Tools → Android → SDK Manager). Go down to the version of Android that you plan to use for your emulator and ensure that the Google APIs System Images are both installed and up to date (Figure 33.2). If an update is available, click the button to install the update and wait until it is ready to go before continuing.
Figure 33.2 Ensuring your emulator is up to date