簡體   English   中英

Awareness API需要哪種依賴關系?

[英]Which dependency is required for Awareness API?

我想查看新的Awareness API,這是一個非常新的。 我正在使用Play Services 9.0.2。 該文檔有這個例子

GoogleApiClient client = new GoogleApiClient.Builder(context)
        .addApi(Awareness.API)
        .build();
client.connect();

但是,沒有提示需要添加哪些依賴項。 任何的想法?

我發現了:我需要升級到PlayServices 9.2.0並且依賴項隱藏在play-services-contextmanager 只需添加這些依賴項,我們就在這里:

compile 'com.google.android.gms:play-services-awareness:10.2.4'

請使用最新的播放服務庫,當時我更新了這個答案,它是10.2.4

如果您想了解最新的Dependency,可以使用我的名為DependencyLookup的 Web工具。

請記住,此庫已添加到Play Services Repository v31中。 確保您在SDK管理器中至少安裝了該版本。

您需要將Google Play服務庫添加到您的項目中。

設置Google Play服務

要訪問Awareness API,您應用的開發項目必須包含Google Play服務。 通過SDK Manager下載並安裝Google Play服務組件,並將庫添加到您的項目中。 有關詳細信息,請參閱Android指南以設置Google Play服務。

資源

設置Google Play服務

要訪問Awareness API,您應用的開發項目必須包含Google Play服務。 通過SDK Manager下載並安裝Google Play服務組件,並將庫添加到您的項目中。 有關詳細信息,請參閱Android指南以設置Google Play服務

這顯然是在同一頁面上,您從這里獲得了代碼示例

大多數情況下,應用程序中方法引用的數量超過65K限制,您的應用程序可能無法編譯。 因此,為了在編譯應用時緩解此問題,請僅指定應用使用的特定Google Play服務API,而不是全部。

compile 'com.google.android.gms:play-services-basement:9.2.0'
compile 'com.google.android.gms:play-services-contextmanager:9.2.0'

你會在這里找到完整的解決方案: http//xordroid.com/create-intelligent-apps-with-google-awareness-api/

啟動PlayServices v9.6.0后, contextmanager已更改為awareness

所以,之前的答案將不起作用。

從v10.2.4開始,正確的依賴關系是

compile 'com.google.android.gms:play-services-basement:10.2.0'
compile 'com.google.android.gms:play-services-awareness:10.2.0'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM