gpt4 book ai didi

android - 适用于 Android 的 Youtube Gdata API 问题

转载 作者:行者123 更新时间:2023-11-30 04:13:30 24 4
gpt4 key购买 nike

我正在使用 Youtube gdata api 从 youtube 获取数据。但是我在线上遇到错误

YouTubeService 服务 = new YouTubeService("myService");

这是我的代码。

YouTubeService service = new YouTubeService("myService");
Log.i("YouTubeApp", "SelectedProgramID: " + urlLink);
VideoFeed videoFeed = null;
try {
videoFeed = service.getFeed(new URL(urlLink), VideoFeed.class);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

进入 IOException block

错误

05-03 19:08:54.085: W/System.err(465): java.io.IOException: Hostname <gdata.youtube.com> was not verified
05-03 19:08:54.085: W/System.err(465): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.getSecureSocket(HttpConnection.java:170)
05-03 19:08:54.095: W/System.err(465): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:398)
05-03 19:08:54.095: W/System.err(465): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.connect(HttpsURLConnection.java:146)
05-03 19:08:54.095: W/System.err(465): at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:511)
05-03 19:08:54.095: W/System.err(465): at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
05-03 19:08:54.095: W/System.err(465): at com.google.gdata.client.Service.getFeed(Service.java:1135)
05-03 19:08:54.095: W/System.err(465): at com.google.gdata.client.Service.getFeed(Service.java:998)
05-03 19:08:54.095: W/System.err(465): at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
05-03 19:08:54.095: W/System.err(465): at com.google.gdata.client.Service.getFeed(Service.java:1017)

我已经添加了这些权限:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

我已经导入了

"activation.jar", 
"additionnal.jar",
"gdata-base-1.0.jar",
"gdata-client-1.0.jar",
"gdata-core-1.0.jar",
"gdata-media-1.0.jar",
"gdata-youtube-2.0.jar",
"guava-12.0.jar" and
"mail.jar"

此代码在独立的 java 命令行项目上运行良好。我的代码有什么问题。?任何想法..

谢谢。

最佳答案

gDATA 无法在 ANDROID EMULATOR 上运行。它总是返回 null

关于android - 适用于 Android 的 Youtube Gdata API 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10432980/

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