开发者

Could not find class error when trying to upload a video to YouTube using the gdata API

开发者 https://www.devze.com 2023-03-17 03:35 出处:网络
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 exa

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', r开发者_开发知识库eferenced 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消