简体   繁体   English

如何使Dropbox Android API与Eclipse配合使用?

[英]How do I get the Dropbox Android API to work with Eclipse?

Whenever I try to run my project, the app crashes with this: 每当我尝试运行我的项目时,应用程序都会崩溃:

E/dalvikvm(17890): Could not find class 'com.dropbox.client2.DropboxAPI', referenced from method ...
...
...
E/AndroidRuntime(17890): Caused by: java.lang.NoClassDefFoundError: com.dropbox.client2.session.Session$AccessType

I actually had this exact problem a few days ago, but I solved it by taking the dropbox jars off my build path, creating a folder in the root of my project called 'libs' and putting the jars in there. 实际上,几天前我确实遇到了这个确切的问题,但是我通过从我的构建路径中删除了Dropbox Jar,在我的项目的根目录中创建了一个名为“ libs”的文件夹,然后将jar放在其中来解决了这个问题。 Now, after making no changes to my project setup, running the project causes it to crash again with the same error I had been getting previously. 现在,在不更改我的项目设置之后,运行该项目会导致它再次崩溃,并出现与我以前相同的错误。

I've tried removing and re-adding the libs folder (and cleaning). 我试着删除并重新添加libs文件夹(并进行清理)。 I've tried adding the jars to my build-path, both when they're sourced within the project in the libs folder and also externally somewhere else on my file system. 我曾经尝试过将jars添加到我的构建路径中,无论它们是从libs文件夹中的项目中获取,还是从文件系统中的其他地方获取。 And Eclipse recognizes the dropbox imports, so there's no errors reported. 而且Eclipse可以识别Dropbox的导入,因此没有错误报告。 I don't know what else to do. 我不知道该怎么办

I am aware of this more-or-less identical question here and this "solution" here . 我知道这更多或更少相同的问题在这里 ,而这种“解决方案” 在这里 Can anyone suggest anything that I could try? 有人可以建议我尝试的吗? I'm blocked until I can figure this out. 我被阻止,直到我能弄清楚。 I'm running Windows with Eclipse Kepler (I think that's 4.3). 我正在使用Eclipse Kepler(我认为是4.3)运行Windows。

EDIT 编辑
It's working again. 再次正常工作。 I checked all the possible options for export in the build-path order/export menu. 我在构建路径命令/导出菜单中检查了所有可能的导出选项。 Previously, only Android Private Libraries and Android Dependencies was checked: 以前,仅检查Android私有库和Android依赖项:

在此处输入图片说明

I'm leaving this open in the hope that someone might tell why this fixed things. 我将其保留为开放状态,希望有人可以告诉您为什么这样做可以解决问题。

i ran into this problem and figured out that when Dropbox said to add all the .jars under the sdk folder lib/ , you're not supposed to add the ones under lib/extra and lib/test . 我遇到了这个问题,发现当Dropbox说要在sdk文件夹lib/下添加所有.jars时,您不应该在lib/extralib/test下添加它们。 So the best way to import (IMO) is 因此,最好的进口方式(IMO)是

  1. Right-Click the Project > Properties > Java Build Path (in sidebar) > "Libraries" tab 右键单击项目>属性> Java构建路径(在边栏中)>“库”选项卡
  2. "Add Library..." > "User Library" > "User Libaries..." > "New..." “添加库...”>“用户库”>“用户库...”>“新建...”
  3. Call it whatever you like, eg "DropboxSDK" 随便叫什么,例如“ DropboxSDK”
  4. Select the library you just made > "Add External Jars..." > Browse to the lib/ folder you downloaded and extracted, select all the jars under lib/ but don't go into the subfolders 选择您刚刚创建的库>“添加外部Jars ...”>浏览至您下载并解压缩的lib/文件夹,选择lib/下的所有jar,但不要进入子文件夹
  5. Click "OK" to go back to the "Add Library" window, check the Library you just made > "Finish" > Your new library should be under the "Libraries" tab 单击“确定”返回到“添加库”窗口,检查刚创建的库>“完成”>新库应位于“库”选项卡下
  6. Switch to "Order and Export" tab > checkmark your library 切换到“订购和出口”标签>选中您的书架
  7. Click "OK" to exit & save ur properties, then clean & rebuild your project 单击“确定”退出并保存您的属性,然后清理并重建您的项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM