【问题标题】:ConnectionResult - Less bulky alternative?ConnectionResult - 体积较小的替代方案?
【发布时间】:2016-07-08 10:04:01
【问题描述】:

我目前正在尝试使用 GoogleAPI 客户端。

我最近遇到了我的应用程序达到 GC 开销限制的问题,所以我更换了

com.google.android.gms:play-services

与相关的游戏服务部门:

com.google.android.gms:play-services-location:9.2.0
com.google.android.gms:play-services-drive:9.2.0

但是,显然我需要整个播放服务 API 来为我的 GooglePlayClient 导入 ConnectionResult。

我的 GooglePlayClient 的 ConnectionResult 有什么替代方案吗?

【问题讨论】:

    标签: android google-play-services


    【解决方案1】:

    Accessing Google APIs 中,只给出了三个指南。

    • 自动管理您与 Google Play 服务的连接。
    • 对任何 Google Play 服务执行同步和异步 API 调用。
    • 在必要的极少数情况下,手动管理您与 Google Play 服务的连接。

    如文档中所述,

    在几乎所有情况下,自动管理的连接都是从您的 Android 应用连接到 Google API 的最佳和最简单的方法。

    但是,在某些情况下,您可能希望在应用中使用手动管理的 Google API 连接,例如您选择执行的操作。但是,在使用它时,您可能还需要 selectively compile APIs 进入您的可执行文件。

    所以,如果您使用的是 Eclipse,为了避免达到 GC Overhead 限制,您可以尝试增加 eclipse.ini 中的 Xms 和 Xmx 值。如果您的默认值为 -Xms40m -Xmx384m,请尝试将它们都更改为 -Xms512m -Xmx512m,然后重新启动 eclipse 看看是否有帮助。

    这些 SO 帖子中给出的解决方案 - Can not run project after adding google play services to projectGC overhead limit exceeded with google play services 也可能有所帮助。

    【讨论】:

    • 呃,我用的是 Android Studio,不是 Eclipse。
    猜你喜欢
    • 2017-01-07
    • 2020-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-02
    • 2017-07-18
    • 1970-01-01
    • 2017-05-12
    相关资源
    最近更新 更多