4

我正在尝试启动一个有意图的选择帐户对话框,我通过GoogleAccountCredential.newChooseAccountIntent.

当我编译我的源代码时,发生了错误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)
4

2 回答 2

0

您需要参考 google play services 库。我有同样的问题并在这里解决:

Android 上的 java.lang.NoClassDefFoundError 与 GoogleAccountCredential.newChooseAccountIntent()

于 2013-05-13T14:44:50.947 回答
0

build.gradle中,将此代码添加到依赖项:

compile('com.google.api-client:google-api-client-android:1.20.0') {
    exclude group: 'org.apache.httpcomponents'
}
于 2016-04-07T06:41:39.920 回答