2012-12-18 40 views
4

我試圖啓動一個選擇帳戶對話框的意圖,我通過GoogleAccountCredential.newChooseAccountIntent獲得。GoogleAccountCredential選擇帳戶內容

當我編譯我的源代碼時,發生錯誤NoClassDefFoundError

這是我的錯誤日誌:

12-18 09:55:51.237: E/AndroidRuntime(25809): FATAL EXCEPTION: main 
12-18 09:55:51.237: E/AndroidRuntime(25809): java.lang.NoClassDefFoundError: com.google.android.gms.common.AccountPicker 
12-18 09:55:51.237: E/AndroidRuntime(25809): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.newChooseAccountIntent(GoogleAccountCredential.java:171) 
12-18 09:55:51.237: E/AndroidRuntime(25809): at com.arcticcoding.study.OverView.onCreate(OverView.java:67) 
12-18 09:55:51.237: E/AndroidRuntime(25809): at android.app.Activity.performCreate(Activity.java:4465) 
12-18 09:55:51.237: E/AndroidRuntime(25809): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
+0

您的設備是否有谷歌播放服務安裝?在嘗試使用Google Play服務API之前,您需要檢查它是否已安裝。 –

回答

0

build.gradle,該代碼添加到依賴性:

compile('com.google.api-client:google-api-client-android:1.20.0') { 
    exclude group: 'org.apache.httpcomponents' 
}