获取Gmail联系人Android应用

时间:2016-03-07 11:44:12

标签: java android contact gmail-api

我想了解如何在Gmail Contacts中抓取app

  

在链接中实现代码   https://developers.google.com/google-apps/contacts/v3/#updating_contacts

我收到以下指定的例外: -

但我得到的异常是Caused by: java.lang.NullPointerException com.google.gdata.client.http.HttpGDataRequest.isOAuthProxyErrorResponse

  

并使用示例代码   http://androidwarzone.blogspot.in/2011/07/android-oauth-full-example-with-source.html

我得到的例外是: -

 03-07 17:05:21.601: E/AndroidRuntime(18754): java.lang.NoClassDefFoundError: Failed resolution of:                                                                                                                                         Loauth/signpost/commonshttp/CommonsHttpOAuthConsumer;
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at com.netcomps.oauth_example.RequestTokenActivity.onCreate(RequestTokenActivity.java:32)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.app.Activity.performCreate(Activity.java:5990)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.app.ActivityThread.access$800(ActivityThread.java:151)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.os.Handler.dispatchMessage(Handler.java:102)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.os.Looper.loop(Looper.java:135)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at android.app.ActivityThread.main(ActivityThread.java:5254)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at java.lang.reflect.Method.invoke(Native Method)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at java.lang.reflect.Method.invoke(Method.java:372)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
 03-07 17:05:21.601: E/AndroidRuntime(18754): Caused by: java.lang.ClassNotFoundException: Didn't find class "oauth.signpost.commonshttp.CommonsHttpOAuthConsumer" on path: DexPathList[[zip file "/data/app/com.netcomps.oauth_example-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
 03-07 17:05:21.601: E/AndroidRuntime(18754):   ... 14 more
 03-07 17:05:21.601: E/AndroidRuntime(18754):   Suppressed: java.lang.ClassNotFoundException: oauth.signpost.commonshttp.CommonsHttpOAuthConsumer
 03-07 17:05:21.601: E/AndroidRuntime(18754):       at java.lang.Class.classForName(Native Method)
 03-07 17:05:21.601: E/AndroidRuntime(18754):       at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
 03-07 17:05:21.601: E/AndroidRuntime(18754):       at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
 03-07 17:05:21.601: E/AndroidRuntime(18754):       at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
 03-07 17:05:21.601: E/AndroidRuntime(18754):       ... 15 more
 03-07 17:05:21.601: E/AndroidRuntime(18754):   Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

你能帮我解决吗?

任何帮助都会受到很大关注。

1 个答案:

答案 0 :(得分:3)

最后,我得到了获取Google / Gmail联系人的解决方案。以下链接非常适合我的问题。

https://tush.wordpress.com/2014/07/15/android-google-contact-api-3-0-example/

这对我有很大帮助。

更新的答案:

Google正在阻止来自webView的oAuth,因此此链接可帮助您获取Gmail联系人https://codelabs.developers.google.com/codelabs/appauth-android-codelab/#2