I am trying to implement Google Drive in my android Applciation, and getting java.lang.NoClassDefFoundError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
error, so anyone who know how to solve this.
I tried still now
- Successfully import all the .jar required for Google Drive
- Import Google Play Service Lib. in my project successfully
- Tried to restart eclipse and check but same error is coming
- Got an API key and Client ID from google Drive API or Play service for Android
- Already visit some solution as here
And trying same as Here
Here is my Logcat-
03-21 15:03:55.194: E/AndroidRuntime(940): FATAL EXCEPTION: main
03-21 15:03:55.194: E/AndroidRuntime(940): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
03-21 15:03:55.194: E/AndroidRuntime(940): at com.example.alltaskass.GoogleDrive.onCreate(GoogleDrive.java:53)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.os.Looper.loop(Looper.java:126)
03-21 15:03:55.194: E/AndroidRuntime(940): at android.app.ActivityThread.main(ActivityThread.java:3997)
03-21 15:03:55.194: E/AndroidRuntime(940): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 15:03:55.194: E/AndroidRuntime(940): at java.lang.reflect.Method.invoke(Method.java:491)
03-21 15:03:55.194: E/AndroidRuntime(940): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
03-21 15:03:55.194: E/AndroidRuntime(940): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
03-21 15:03:55.194: E/AndroidRuntime(940): at dalvik.system.NativeStart.main(Native Method)
But still I am stuck for this error,and dont know how to solve this, Please guide me
Thank you in advance
I solved by add google-play-service
This error is due to the user defined JAR file ( that is you have converted JAVA file into JAR file in order to import the library for your own use ) which you have compiled in the library for this application. In order to overcome this error you have to just take the JAVA file and you have give in a separate class in your package.
I was having the same problem until a minute ago. In your app's properties make sure you are targeting an API level with Google API's. They will be listed right below the target level (4.0.3 in my case).
I was helped by the following:
check Drive API in Project Properties/Java Build Path/Order and Export
thereafter Drive API jars added to the project to lib folder
uncheсk Drive API
I had the same problem. I solved this by exporting all the drive related jars (mark with "v") in "Order and Export" tab of the build window.