Getting started with DropboxAPI, class not found

旧城冷巷雨未停 提交于 2019-12-07 16:41:10

问题


I'm trying to use the Dropbox API for the first time, but i'm getting this error when launching my app.

Caused by: java.lang.NoClassDefFoundError: com.dropbox.client2.session.Session$AccessType

I saw on Dropbox forums a guy with the same problem, and the solution was to rename the class path to libs/ instead of lib/. I did it and didn't work.

I get the error here:

final static private AccessType ACCESS_TYPE = AccessType.APP_FOLDER;

any ideas?


回答1:


This problem appeared when I imported dropbox jars in the next way: eclipse project menu -> Build Path -> Configure Build Path -> Libraries -> Add External JARs;

After that, I revert changes, create folder 'libs' in Project Explorer, in 'libs' folder menu select 'Import...' -> File System. Select path and import all jars into 'libs' project folder. Problem disappear.




回答2:


My mistake, the problem was the classPath.




回答3:


I had to add all reference libraries in both the lib and libs folder before it worked, so something is clearly wrong, and for some reason it needs apache-mime4j-0.6 in the lib folder, but the example project from Dropbox on how to implement it don't? can someone from the Dropbox Team deliberate on this? Note: the application used the previous deprecated api, and when I tried updating it with the newest I got this error.

java.lang.NoClassDefFoundError: com.dropbox.client2.session.Session$AccessType

on

private AccessType ACCESS_TYPE = AccessType.APP_FOLDER;



回答4:


Step to set jar file for dropbox .

u must add dropbox-android-Sdk.jar file as library.

Add to build path and then go to properties.

go in java build path and click order and export and click that dropbox-android-sdk.jar file.

u can also add jar and locate your dropbox-android-sdk.jar file and then ok.



回答5:


Working in Eclipse (Luna) I could resolve the error by Project->Properties->Java Build Path->Order And Export and then putting a tick on (in my case for Dropbox 1.6.3) the two Dropbox jar files. Followed by the usual clean project and run.
This is reproducable by removing the checks marks from the boxes in the Order and Export dialog.




回答6:


Please check the name of the project libs, its correct name is libs.



来源:https://stackoverflow.com/questions/10557633/getting-started-with-dropboxapi-class-not-found

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