NoClassDefFoundErrror with Google Drive

I have a project with Google Drive turned on and everything works fine. Then I updated the Android SDK and Eclipse ADT Plugin, and Google Drivie no longer works, and I can’t understand why.

I added the Drive API to my project, as well as to the Google Play services, and put a checkmark on the export. I did a clean build, I deleted the bin directory of my application, restarted eclipse, restarted the clean assembly, but as soon as I started the section of my application that should display the solution for the google account, the application crashes.

Below is the error returned in logcat

05-18 17:17:09.089: E/AndroidRuntime(16747): FATAL EXCEPTION: main 05-18 17:17:09.089: E/AndroidRuntime(16747): java.lang.NoClassDefFoundError: com.google.android.gms.common.AccountPicker 05-18 17:17:09.089: E/AndroidRuntime(16747): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.newChooseAccountIntent(GoogleAccountCredential.java:171) 

No matter what I try to do, it does not matter, so any help would be greatly appreciated.

UPDATE I tried to check the export options for private Android libraries, as suggested by Raghunandan. Most applications work, for example, the Dropbox API, which is also included in the project, but I still get an error when part of the Google Drive code is executed, with NoClassDefFoundError.

If I marked the Drive API in the Order and Export tabs, I get the error message Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/api/client/googleapis/extensions/android/accounts/GoogleAccountManag‌​er;

0
source share
3 answers

It looks like you are importing several libraries defining the com.google.api.client.googleapis.extensions.android.accounts.GoogleAccountManag‌er class. Go to the package manager in the "Private Android Libraries" section and try opening the .jar files there. You will probably find this class in at least two of them (one of them may be something like google-api-client-android-1.13.2-beta.jar ).

Try to exclude one of the jar files from your build path. If you have no mistakes, everything is ready. If there are errors, try excluding another jar file. If errors remain, you can try opening the jar as a zip and manually deleting the GoogleAccountManager.class file.

+2
source

Try going to Project → Properties → Order and Export and make sure that the private Android libraries are checked for your project and for all other library projects that you use.

+1
source

I have the same problem and I solved it now.

First I try to download Dredit and it works great !! So I remove google api from properties (properties-> Java Build Path-> Libraries). and copy the libraries from Dredit. Guess what? the problem still exists.

So, I take the following steps to rebuild the entire project, and this problem is solved. Hope this helps you.

  • Uninstall googe api and all related libraries.
  • Close this project
  • Open the project folder and delete and hide the folder (start from.) And the generated folder
  • Re-enable the project. And copy the libs Dredit form
0
source

All Articles