java.lang.NoClassDefFoundError on Android with GoogleAccountCredential.newChooseAccountIntent()

谁都会走 提交于 2019-12-01 08:24:32

OK, I've found out what I was missing.

  1. Ensure you have downloaded the Android SDK Services -> Extras -> Google Play services

  2. Follow the instructions provided by the following link to add the google-play-services-lib library to your project:

http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject

Best Regards

I've run into a similar problem lately. My app (not in production yet) would suddenly (since the beginning of May) start throwing uncatchable 'NoClassDefFoundError' error when calling

GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE_FILE)

method. It was happening randomly, usually first time in the morning. I could fix it by re-installing my Google account. Not a good solution for production, though. I've spent frustrating couple of hours trying to resolve it until I finally realized I have another app that does not have the same problem in the same code sequence. So I diff-ed both of them and realized that the "good" one had a different sequence of entries in 'Package Explorer->Project->Properties->Java Build Path' The 'good' one had

'google-play-services.jar' BEFORE 'android-support-v4.jar',

where the 'bad' one had it backwards. So I switched the sequence (using UP, DOWN buttons in the dialog) and it seems to solve the problem. Yet another WT... ? moment! Does anybody have an opinion on this?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!