找不到类错误尝试使用gdata的API来上传视频到YouTube时,找不到、错误、上传、视频

2023-09-05 08:26:59 作者:╭⌒浅夏

我目前正在写上传使用谷歌数据API视频到YouTube一个Android应用程序的一部分。我从谷歌code API的最新版本,我已经基本复制从他们的开发人员指南暂且。

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.

一切编译没有警告或错误,以及应用程序运行正常。但是,当我打电话service.insert(......)我碰到下面的堆栈跟踪:

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

有出现NoClassDefFoundError。

with a NoClassDefFoundError.

我把所有的依赖关系GDATA API在Eclipse中(包括在API的DEPS目录中的两个,也JavaMail的,活化和servlet-API),我也尝试添加的所有jar文件链接到我的项目在Eclipse中的类路径中。我已经通过相关罐子一看,所有的类它声称它无法找到是肯定有的。

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.

如果有人可以帮助以任何方式 - 任何想法在这个阶段就会大大AP preciated

If anyone could help in any way - any ideas at this stage would be greatly appreciated.

感谢

推荐答案

原来正常的JavaMail /激活包目前没有在Android上运行。解决的办法是使用的JavaMail对于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.