2013-05-19 65 views
3

移至Android Studio後,我無法再添加和使用Google Play服務庫。無法在Android Studio中使用Google Play服務庫

我創建了一個簡單的項目,我添加庫作爲模塊,在登錄按鈕,在我的佈局,但是當我運行,因爲ClassNotFoundException異常的應用程序崩潰...

任何有同樣的問題?

+1

結束將.jar添加爲庫,以便現在可以使用它。 – fasteque

+0

試試這個: http://stackoverflow.com/questions/16596715/how-can-i-create-an-android-application-in-android-studio-that-uses-the-google-m – lucasddaniel

+1

如果你在這裏尋找解決方案,請不要將Google Play服務庫添加爲.jar,正如我在上面所提到的。 在Android Studio中現在可以使用官方的Maven倉庫,如下所述:https://plus.google.com/+AndroidDevelopers/posts/4Yhpn6p9icf – fasteque

回答

0

兩年後,我創建了這個問題,很多事情都發生了變化,涉及Android Studio以及如何使用Google Play Services library。 我想我可以回答我的報告正式文件的重要步驟,這可以在這裏找到:https://developers.google.com/android/guides/setup

我還假設您已經安裝的Android Studio的更新版本與最新SDK Tools

因此,這裏的程序:

- 從SDK管理器中添加所需的SDK包:

  • 谷歌庫
  • 谷歌Play服務

正式文件可以在這裏找到:https://developer.android.com/sdk/installing/adding-packages.html

- 打開build.gradle文件的應用模塊目錄內dependencies下添加一個新的構建規則的播放服務的最新版本。 例如:

apply plugin: 'com.android.application' 
... 

dependencies { 
    compile 'com.google.android.gms:play-services:7.5.0' 
} 

務必在更新此版本號每次谷歌Play服務更新。

- 保存更改並單擊工具欄中的同步工程與搖籃文件

從版本6.5開始,您可以選擇性地將Google Play服務API編譯到您的應用中。 在官方文檔中,您可以找到individual APIs和相應的build.gradle說明的完整列表。

包摘要:https://developers.google.com/android/reference/com/google/android/gms/package-summary

當你創建一個新的項目,Android的Studio還提供了谷歌播放服務活動模板。

相關問題