For completeness
I assume that you are caught in this exception by following the sample code from Google Drive QuickStart . If so, you can find the following things that I had to change.
Google Play Services Lib (see comment below!)
The documentation uses the old way to add libraries to an Android project. This will fail when executed using the latest ADT. You will be able to compile and download to the device / emulator, but upon execution you will receive a NoClassDefFoundError.
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/AccountPicker;
To fix this, you must copy the google-play-services.jar file to the libs folder.
Missing meta tag
Until the next error. Then I got an IllegalStateException with instructions on adding a meta tag in the manifest with google-play-services version.
So, in the manifest application tag, add:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
And in one of the resource files ( res/values/a-file-here.xml ) add the following:
<integer name="google_play_services_version">4030500</integer>
In my case, lib corresponded to this version. If you enter the wrong version here, you will receive an error message indicating the correct version. So be sure to check out.
Permission denied
Finally, I received an invitation for oauth in the application to find out that the sample application still does not have permission. Error for reference:
java.io.FileNotFoundException: /storage/emulated/0/Pictures/IMG_20131211_110629.jpg: open failed: EACCES (Permission denied)
Next to the rights listed in the example:
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.INTERNET" />
Also add permission WRITE_EXTERNAL_STORAGE to the manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Additional resources
If you get a com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException exception and the Unknown root description is somewhere, you should check the settings in the Google API console . I got this error when the package does not match.
Other interesting links are the oauth2 documentation and google api playground .