我是Android开发的新手(但总体上不是开发)。在iOS中,文档清楚地说明了特定iOS的哪个版本可用。
在Android系统中,我很困惑。我使用的是android-10平台,minimumSDK和targetSDK都是10,我使用的是Google服务7.5.0。
据我所知,我在android-10中使用的api仍然适用于较晚版本的android (4.4.4、5.0等)。但是我怎么知道Google Play Services 7.5.0会起作用呢?所有来自Lollipop的操作系统版本都会恢复到2.3.3吗?我没有足够的测试设备。
在我的build.grade文件中,我指定了:
dependencies{
....
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services-ads:7.5.0'
....
}我不完全理解这些行是什么意思(我从一些教程中了解了它们)。我怎么知道它们将兼容哪个Android操作系统版本呢?这些线在Build.gradle可以吗?
发布于 2015-08-19 04:24:25
compile 'com.google.android.gms:play-services:+'当您使用加号而不是指定版本时,gradle将自动下载并使用它找到的库的最新版本。不建议这样做,因为当gradle开始使用新版本时,库的不同版本之间的潜在更改可能会破坏您的代码。最好你自己来说明。例如
compile 'com.google.android.gms:play-services:7.8.0'这将导入整个播放服务库,因此实际上不需要将第二个play-services-ads:7.5.0行作为其完全就绪的导入。
而且,由于播放服务库太大,所以使用整个程序并不是一个好主意。最好只使用你的应用程序所需的模块。每个部件都可以使用compile '<module>'指定。它会为你节省空间和建造时间。
Google+ com.google.android.gms:play-services-plus:7.5.0
Google Account Login com.google.android.gms:play-services-identity:7.5.0
Google Actions, Base Client Library com.google.android.gms:play-services-base:7.5.0
Google App Indexing com.google.android.gms:play-services-appindexing:7.5.0
Google App Invites com.google.android.gms:play-services-appinvite:7.5.0
Google Analytics com.google.android.gms:play-services-analytics:7.5.0
Google Cast com.google.android.gms:play-services-cast:7.5.0
Google Cloud Messaging com.google.android.gms:play-services-gcm:7.5.0
Google Drive com.google.android.gms:play-services-drive:7.5.0
Google Fit com.google.android.gms:play-services-fitness:7.5.0
Google Location, Activity Recognition, and Places com.google.android.gms:play-services-location:7.5.0
Google Maps com.google.android.gms:play-services-maps:7.5.0
Google Mobile Ads com.google.android.gms:play-services-ads:7.5.0
Google Nearby com.google.android.gms:play-services-nearby:7.5.0
Google Panorama Viewer com.google.android.gms:play-services-panorama:7.5.0
Google Play Game services com.google.android.gms:play-services-games:7.5.0
SafetyNet com.google.android.gms:play-services-safetynet:7.5.0
Google Wallet com.google.android.gms:play-services-wallet:7.5.0
Android Wear com.google.android.gms:play-services-wearable:7.5.0最后,要知道哪个级别的playservices可以与开发人员指南进行比较
Overview of Google Play Services
上面写着
Google服务APK是通过Google提供的,因此对服务的更新不依赖于运营商或OEM系统的图像更新。一般来说,运行Android2.3 (API级别9)或更高版本并安装Google服务应用程序的设备在几天内就会收到更新。这使您可以在Google服务中使用最新的API,并可以访问Android生态系统中的大多数设备。不支持比Android2.3更老的设备,也不支持没有Google服务应用程序的设备。
发布于 2015-12-14 11:13:59
最好在运行时检查设备上的Google服务的可用性/版本。
根据https://developers.google.com/android/guides/setup
“因为很难预测每个设备的状态,所以在访问Google服务功能之前,必须始终检查兼容的Google服务APK。”
“强烈鼓励您使用GoogleApiClient类访问Google服务功能。这种方法允许您将OnConnectionFailedListener对象附加到客户端。要检测设备是否具有适当版本的Google服务APK,请实现onConnectionFailed()回调方法。如果连接由于缺少或过时的Google版本而失败,回调将接收SERVICE_MISSING、SERVICE_VERSION_UPDATE_REQUIRED或SERVICE_DISABLED等错误代码。”
https://stackoverflow.com/questions/32086428
复制相似问题