尝试使用 gdata API 将视频上传到 YouTube 时出现找不到类错误
我目前正在编写 Android 应用程序的一部分,以使用 Google Data API 将视频上传到 YouTube。我有来自 Google Code 的最新版本的 API,我基本上是从他们的开发人员的示例中复制了示例暂时指南。
一切都会编译,没有警告或错误,并且应用程序运行良好。但是当我调用 service.insert(...) 时,我得到以下堆栈跟踪:
ERROR/dalvikvm(19489): Could not find class 'com.google.gdata.data.media.MediaBodyPart$MediaSourceDataHandler', referenced from method com.google.gdata.data.media.MediaBodyPart.initMediaDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method com.google.gdata.data.media.MediaBodyPart.initMediaDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.mail.internet.MimeBodyPart$MimePartDataHandler', referenced from method javax.mail.internet.MimeBodyPart.writeTo
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.attachFile
ERROR/dalvikvm(19489): Could not find class 'javax.mail.internet.MimeBodyPart$MimePartDataHandler', referenced from method javax.mail.internet.MimeBodyPart.getDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.updateHeaders
带有 NoClassDefFoundError。
我在 Eclipse 中将 gdata API 的所有依赖项链接到我的项目(这两个包含在 API 的 deps 目录中,还有 javamail、activation 和 servlet-api),并且我尝试将所有 jar 文件添加到类路径中在日食中。我查看了相关的罐子,它声称找不到的所有类肯定都在那里。
如果有人能以任何方式提供帮助 - 现阶段的任何想法将不胜感激。
谢谢
I am currently writing part of an Android application to upload a video to YouTube using the Google Data API. I have the latest version of the API from Google Code, and I have basically copied the example from their Developer's Guide for the time being.
Everything compiles with no warnings or errors, and the app runs fine. But when I call service.insert(...) I get the following stack trace:
ERROR/dalvikvm(19489): Could not find class 'com.google.gdata.data.media.MediaBodyPart$MediaSourceDataHandler', referenced from method com.google.gdata.data.media.MediaBodyPart.initMediaDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method com.google.gdata.data.media.MediaBodyPart.initMediaDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.mail.internet.MimeBodyPart$MimePartDataHandler', referenced from method javax.mail.internet.MimeBodyPart.writeTo
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.attachFile
ERROR/dalvikvm(19489): Could not find class 'javax.mail.internet.MimeBodyPart$MimePartDataHandler', referenced from method javax.mail.internet.MimeBodyPart.getDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.updateHeaders
with a NoClassDefFoundError.
I have all the dependencies for the gdata API linked to my project in Eclipse (the two included in the deps directory of the API, and also javamail, activation and servlet-api), and I have tried adding all the jar files to the classpath in Eclipse. I have looked through the relevant jars and all the classes it claims it can't find are definitely there.
If anyone could help in any way - any ideas at this stage would be greatly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,普通的 JavaMail/Activation 包目前无法在 Android 上运行。解决方案是使用 JavaMail for Android,效果非常好。
It turned out that the normal JavaMail/Activation packages currently don't work on Android. The solution was to use JavaMail for Android, which works perfectly.