The recently released version of Google Play Services presents itself as a library
project with string and attribute resources coupled with a .jar
in the libs/
folder
that has been compiled against internal APIs.
While this is convenient for users of IDEs or Ant, it presents a problem for those using
proper build systems (e.g., Maven, Gradle) with dependency management. Inside the .jar
there are a lot of classes
which reference static attributes on the com.google.android.gsm.R
class. This means that
the library must exist in a project which declares that package in its manifest
(thus causing aapt
to generate an R.java
for it). While this makes sense, it presents
a problem for users of artifact repositories.
If you use Maven, you can do the following in order to depend on Google Play Services as a library project:
- Copy the
pom.xml
anddeploy.sh
scripts into thegoogle-play-services_lib/
folder inside of your SDK. - Execute
bash deploy.sh
which will install the.jar
into your local Maven repository. - Run
mvn install
which will install the Google Play Services as a library project into your local Maven repository.
Once completed you can depend on this library project with the following dependency declaration:
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>3</version>
<type>apklib</type>
</dependency>