如何使用Gradle将Google Play Services for Froyo添加到项目中? [英] How to add Google Play Services for Froyo to the project using Gradle?

查看:296
本文介绍了如何使用Gradle将Google Play Services for Froyo添加到项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 Google Developers Portal 的信息:



  1. 打开应用程序目录中的build.gradle文件。 添加一个新的在依赖关系下为最新版本的播放服务构建规则。例如:




  apply plugin:'android'
...

依赖关系{
编译'com.android.support:appcompat-v7:+'
编译'com.google.android.gms:play-服务:4.0.30'
}

但这是非标准Google Play服务的指令。 Google Play Services for Froyo是一个不同的模块。我从来没有与Gradle合作 - 我需要做些什么来为Froyo添加Google Play服务?

Google Play服务for Froyo库,使用Android SDK Manager(在底部的附加类别下),您应该能够在 AndroidManifest.xml < Android SDK主页> \extras\google\google_play_services_froyo\libproject\google- play-services_lib



在我的电脑上,Google Play Services的 AndroidManifest.xml 对于Froyo看起来像这样:

 <?xml version =1.0encoding =UTF-8?> < manifest android:versionName =3.2.65(834000-30)
android:versionCode =3265130package =com.google.android.gms
xmlns:android =http: //schemas.android.com/apk/res/android\"> ;<uses-sdk
android:minSdkVersion =8/>< / manifest>

然后,您应该可以在Gradle中使用此版本名称(第一部分):

 依赖关系{
编译'com.android.support:appcompat-v7:+'
编译'com.google .android.gms:play-services:3.2.65'
}

只要确保您还可以通过Android SDK管理器(也可在Extras类别下)安装最新版本的Google Repository和Android Support Repository。


Information from Google Developers Portal:

  1. Open the build.gradle file inside your application directory.
  2. Add a new build rule under dependencies for the latest version of play-services. For example:

apply plugin: 'android'
...

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.google.android.gms:play-services:4.0.30'
}

But this is instruction for standart Google Play Services. Google Play Services for Froyo is a different module. I've never worked with Gradle - what I need to do to add Google Play Services for Froyo?

解决方案

If you download "Google Play services for Froyo" library using the Android SDK Manager (under the "Extras" category towards the bottom), you should be able to see the current version number in the AndroidManifest.xml bundled with the google_play_services_froyo library, in <Android SDK Home>\extras\google\google_play_services_froyo\libproject\google-play-services_lib.

On my computer, AndroidManifest.xml for Google Play Services for Froyo looks like this:

<?xml version="1.0" encoding="UTF-8"?> <manifest android:versionName="3.2.65 (834000-30)" 
  android:versionCode="3265130" package="com.google.android.gms" 
  xmlns:android="http://schemas.android.com/apk/res/android"><uses-sdk 
  android:minSdkVersion="8"/></manifest>

You should then be able to use this version name (the first part) with Gradle:

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.google.android.gms:play-services:3.2.65'
}

Just make sure you also have the latest versions of "Google Repository" and "Android Support Repository" also installed via the Android SDK Manager (also under the "Extras" category).

这篇关于如何使用Gradle将Google Play Services for Froyo添加到项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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