在Maven项目如何使用谷歌播放服务? [英] How can i use google play services in a maven project?

查看:494
本文介绍了在Maven项目如何使用谷歌播放服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以给我一步一步的教程约我怎么能在一个Maven项目中使用谷歌播放服务? 我已经添加了两个依赖

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> 

在apklib和jar出现在Maven仓库,但不会产生com.google.android.gms.R类。

The apklib and jar appears in maven repository but the com.google.android.gms.R class is not generated.

我收到的NoClassDefFoundError。我怎样才能把com.google.android.gms在根文件夹?

I recieve NoClassDefFoundError. How can i put the com.google.android.gms in the gen folder?

推荐答案

您可以使用的Andr​​oid SDK Maven的部署的不仅仅是谷歌播放服务

You can use the Android Maven SDK Deployer for more than just Google Play Services

顺便说一句,你应该使用13.0.0版本,而不是4

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>

。AAR与Android,Maven的插件3.8.2 +

使用Android的Maven的插件3.8.2,您还可以使用播放服务AAR

".aar" with android-maven-plugin 3.8.2+

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>

这篇关于在Maven项目如何使用谷歌播放服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆