This tutorial will show you how to include Google Play Services into IDEA 12.

Step 1 – make sure to get Google Play Services from Android SDK Manager

image

Step 2 – Once this is done, start IDEA 12 and open the project that you want to add Google Play Services to.

Step 3 – IDEA 12 has to be configured to import Google Play Services as a module.

In IDEA 12, open the project structure dialog. Then make sure to add the Google Play Services module from your Android SDK location to IDEA 12. In my case, this is the following: ~/dev-tools/android-sdk-macosx/extras/google/google_play_services/libproject/, shown below:

image

So we are only 50% done at this point. Once the Google Play Services libproject is added as a module to your project, you then have to add it as a dependency to your project. In my case, this is what it looks like (note that we’ve not added the JAR file yet).

image

By adding the Google Play Services libproject as a module (which my project depends on), I can now do things like this in the AndroidManifest.xml of my project (this takes an integer defined in values.xml of the libproject and imports into into my project).

image

And the last step is adding a JAR file dependency into my main project; even though we added the module libproject as a dependecy, this doesn’t automatically add the JAR file (although it does create a library entry for it in the project).

Step 4 – Import the Google Play Services JAR file as a library dependency for the main project.

When the libproject is imported as a module, it automatically creates a library entry for the JAR file. In my case, this is what it looks like:

image

This library entry then has to be added as a dependency for my main project. In the project settings, you can just add this library as a dependency for your main project as shown here:

image

In summary, you need both of the following to be added as a dependency:

  • The Google Play Services libproject must be added as a module, then as a dependency for the main project
  • The Google Play Service JAR library is automatically created for you when you import the libproject, however, it must be added as a dependency manually to your main project.