Somebody can give me a step by step tutorial about how can I use google play services in a maven project? I've added two dependencies
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>4</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>4</version>
<type>jar</type>
</dependency>
The apklib and jar appear in maven repository but the com.google.android.gms.R class is not generated.
I receive NoClassDefFoundError. How can I put the com.google.android.gms in the gen folder?
You can use the Android Maven SDK Deployer for more than just Google Play Services
Btw you should use version 13.0.0 and not 4
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>13.0.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>13.0.0</version>
</dependency>
With android-maven-plugin 3.8.2 you can also use the play services aar
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services</artifactId>
<version>4.0.30</version>
<type>aar</type>
</dependency>
After importing the google-play-services_lib project into your Eclipse workspace and making it a library you need to setup the maven build process.
Make a zip file of the "google-play-services_lib" folder and call it "google-play-services_lib.apklib"
+ google-play-services_lib.apklib
+ src
+ res
+ AndroidManifest.xml
+ project.properties
Open the command prompt and go to the folder where the zip file is and type the following command. This will install the apklib into you local maven repository.
mvn install:install-file -Dfile=google-play-services_lib.apklib -DgroupId=com.google.android.gms -DartifactId=google-play-services -Dversion=14.0.0 -Dpackaging=apklib
Now you need to install the google-play-services jar into your local repository.
mvn install:install-file -Dfile=google-play-services.jar -DgroupId=com.google.android.gms -DartifactId=google-play-services -Dversion=14.0.0 -Dpackaging=jar
Go back into Eclipse and open your android pom file and enter the following dependency
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>14.0.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>14.0.0</version>
</dependency>
Now you can run your maven package command to have output update with the google play jar and the apklib merged into your apk file.
mvn package -Pandroid -Psign
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With