gpt4 book ai didi

java - Android 在尝试从 YouTube 获取数据时崩溃?

转载 作者:行者123 更新时间:2023-12-02 00:38:55 25 4
gpt4 key购买 nike

我得到了这个 fragment ,它应该是从 YouTube 上吐出某些视频的标题。

 public static void getVids() {
try {
YouTubeService myService = new YouTubeService("mycompany-myapp-1");
String myFeed = "http://gdata.youtube.com/feeds/videos?start-index=1&max-results=25&vq=lizards&oi=spell";
printVideoFeed(myService, myFeed);
} catch (IOException ex) {
Toast toast = Toast.makeText(null, "Error "+ex.toString(), 5000);
toast.show();
} catch (ServiceException ex) {
Toast toast = Toast.makeText(null, "Error "+ex.toString(), 5000);
toast.show();
}
}

private static void printVideoFeed(YouTubeService service, String feedUrl) throws IOException, ServiceException {
VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
List<VideoEntry> allVideos = videoFeed.getEntries();
Iterator<VideoEntry> itAllVideos = allVideos.iterator();
String Titles = "";
while (itAllVideos.hasNext()){
VideoEntry oneVideo = itAllVideos.next();
TextConstruct oneVideoTitle = oneVideo.getTitle();
Titles = Titles + " | " + oneVideoTitle.toString();
}

Toast toast = Toast.makeText(null, "Working! " + Titles , 5000);
toast.show();

}

但是当我执行它时它崩溃了。 logcat 的内容如下:

08-05 17:33:30.203: INFO/dalvikvm(13832): Failed resolving Lcom/google/gdata/data/media/MediaSource; interface 1435 'Ljavax/activation/DataSource;'
08-05 17:33:30.207: WARN/dalvikvm(13832): Link of class 'Lcom/google/gdata/data/media/MediaSource;' failed
08-05 17:33:30.207: INFO/dalvikvm(13832): Failed resolving Lcom/google/gdata/data/media/BaseMediaSource; interface 452 'Lcom/google/gdata/data/media/MediaSource;'
08-05 17:33:30.207: WARN/dalvikvm(13832): Link of class 'Lcom/google/gdata/data/media/BaseMediaSource;' failed
08-05 17:33:30.207: WARN/dalvikvm(13832): Unable to resolve superclass of Lcom/google/gdata/data/media/MediaStreamSource; (435)
08-05 17:33:30.207: WARN/dalvikvm(13832): Link of class 'Lcom/google/gdata/data/media/MediaStreamSource;' failed
08-05 17:33:30.207: ERROR/dalvikvm(13832): Could not find class 'com.google.gdata.data.media.MediaStreamSource', referenced from method com.google.gdata.client.media.MediaService.getMediaResource
08-05 17:33:30.207: WARN/dalvikvm(13832): VFY: unable to resolve new-instance 453 (Lcom/google/gdata/data/media/MediaStreamSource;) in Lcom/google/gdata/client/media/MediaService;
08-05 17:33:30.207: DEBUG/dalvikvm(13832): VFY: replacing opcode 0x22 at 0x0013
08-05 17:33:30.207: DEBUG/dalvikvm(13832): VFY: dead code 0x0015-0039 in Lcom/google/gdata/client/media/MediaService;.getMediaResource (Ljava/net/URL;Lcom/google/gdata/util/ContentType;Lcom/google/gdata/data/DateTime;)Lcom/google/gdata/data/media/MediaSource;
08-05 17:33:30.210: INFO/dalvikvm(13832): Failed resolving Lcom/google/gdata/data/media/MediaSource; interface 1435 'Ljavax/activation/DataSource;'
08-05 17:33:30.210: WARN/dalvikvm(13832): Link of class 'Lcom/google/gdata/data/media/MediaSource;' failed
08-05 17:33:30.210: WARN/dalvikvm(13832): VFY: unable to find class referenced in signature (Lcom/google/gdata/data/media/MediaSource;)
08-05 17:33:30.210: INFO/dalvikvm(13832): Failed resolving Lcom/google/gdata/data/media/MediaSource; interface 1435 'Ljavax/activation/DataSource;'
08-05 17:33:30.210: WARN/dalvikvm(13832): Link of class 'Lcom/google/gdata/data/media/MediaSource;' failed
08-05 17:33:30.210: INFO/dalvikvm(13832): Could not find method com.google.gdata.data.media.MediaSource.getName, referenced from method com.google.gdata.client.media.MediaService.initMediaRequest

...

您认为问题可能出在哪里?

谢谢!

最佳答案

我也有类似的问题。解决方案应该是将您的 JavaMail 库替换为找到的库 here (Android 版 JavaMail)。

关于java - Android 在尝试从 YouTube 获取数据时崩溃?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6958142/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com