Copy the library from the SDK/Extras
Directory
Use your SDK Manager to download the Google Play Services - it'll be found under the Extras directory.
Go to your Android SDK directory and find the
google-play-services_lib
directory, for me this was in the Android Studio package:/Applications/Android Studio.app/sdk/extras/google/google_play_services/libproject/google-play-services_lib/
Copy this entire directory to your project's
libs
directory.Add this as a module dependency as you normally would. (For Android Studio, see below for step-by-step instructions.)
You'll need to add a
meta-tag
to yourAndroidManifest.xml
file as well, that looks like this:<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Profit and Party?
Android Studio Steps
Steps to add the library project as a module dependency once it's already in your libs
directory.
File > Import Module
.Select the
google-play-services_lib
directory under yourlibs
directory.Ensure
Create module from existing sources
is selected and clickNext
until you finish the wizard.Project Structure
>Modules
(far left) > Select Your App >Dependencies
tab >+
>Module Dependency
>google-play-services_lib
.Project Structure
>Modules
(far left) > Selectgoogle-play-services_lib
>Dependencies
tab > + >Jars or directories...
> Find and selectlibs/google-play-services_lib/libs/google-play-services.jar
.Make sure you click the
Export
checkbox for this dependency.Profit and Party?
Many thanks to Adama Speakman's post for the specific Android Studio steps.
JP