java - 获取 Gmail 联系人 Android 应用程序

标签 java android contacts gmail-api

我正在尝试弄清楚如何在我的 应用 中获取 Gmail 联系人

On implementing the code in the link https://developers.google.com/google-apps/contacts/v3/#updating_contacts

我收到下面指定的异常:-

但是我收到由 引起的异常:java.lang.NullPointerException com.google.gdata.client.http.HttpGDataRequest.isOAuthProxyErrorResponse

And using the example code on 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

你能帮我一下吗?

我们将非常感谢任何帮助。

最佳答案

最后,我找到了获取 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

关于java - 获取 Gmail 联系人 Android 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35842866/

相关文章:

java - 如何使用 Apache POI 基于下拉选择在同一工作簿中创建多个工作表?

iphone - 创建类似于 iPad 的 'Contacts' 应用程序的地址簿 UI

objective-c - 从联系人中获取所有电子邮件地址 (iOS)

java - 配置 log4j 在登录模式之前调用静态函数

java - 从 Java 执行 Shell 脚本,具有读取操作的 Shell 脚本

android.graphics.drawable.RippleDrawable 错误

安卓滑动菜单 : Menu takes entire screen and wont retract

android - Eclipse 无法编译 apk

未收到 PHP 联系表单消息

java - process.waitFor() 永远不会返回