Re: [問題] 如和利用GOOGLE的YOUTUBE API上傳影片
※ 引述《david800427 (A_wei)》之銘言:
: 請問有大大在ANDROID上實作過GOOGLE的YOUTUBE API嗎???
: 我已經可以在JAVA中裡用YOUTUBE的API上傳影片及撈出所有上傳過影片的資訊
: 但是當我要移植到ANDROID上時,卻一直沒有回應就關閉
: 問題出在這行 :
: YouTubeService ytservice = new YouTubeService("AppName",Dev_Key);
: LOG說
: java.lang.NoClassDefFoundError: com.google.gdata.client.youtube.YouTubeService
: 該放進去的JAR檔我都有放呀!!
: 不知道有沒有有經驗的大大知不知道錯誤在哪????
借標題問一下
最近也碰到一樣的問題~"~
service = new YouTubeService("clientID","Developer Key");
try {
service.setUserCredentials("gmail_address", "password");
} catch (AuthenticationException e) {
e.printStackTrace();
}
---我把upload()寫在Button_Click事件裡,程式碼如下:---
VideoEntry newEntry = new VideoEntry();
YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent("My Test Movie");
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword("cars");
mg.getKeywords().addKeyword("funny");
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent("My description");
mg.setPrivate(false);
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME,
"mydevtag"));
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME,
"anotherdevtag"));
newEntry.setGeoCoordinates(new GeoRssWhere(37.0, -122.0));
MediaFileSource ms = new MediaFileSource(new File("video.mp4"),
"video/quicktime");
newEntry.setMediaSource(ms);
String uploadUrl =
"http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
try {
VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);
} 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();
}
------------
專案裡丟了以下的jar檔:
android-support-v4
com.google.gdata.client
gdata-client-1.0
com.google.gdata
gdata-media-1.0
gdata-youtube-2.0
gdata-media-1.0-sources
gdata-youtube-meta-2.0
google-api-client-1.4.1-beta
google-collections
但編譯後會出現錯誤
java.lang.NoClassDefFoundError:
com.google.gdata.client.youtube.YouTubeService
還有 String uploadUrl =
"http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
這個上傳網址是要再另外申請的嗎?
申請完再把default替換成自己的ID之類的?
我看了Interactive YouTube API Demo Beta的網頁
但還是不知該從何下手~"~
懇請大大求解
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.11.129.171
※ 編輯: jokie 來自: 27.105.27.110 (12/11 22:29)
→
12/11 23:11, , 1F
12/11 23:11, 1F
→
12/11 23:13, , 2F
12/11 23:13, 2F
→
12/11 23:13, , 3F
12/11 23:13, 3F
→
12/13 00:50, , 4F
12/13 00:50, 4F
→
12/13 09:27, , 5F
12/13 09:27, 5F
→
12/13 09:28, , 6F
12/13 09:28, 6F
→
12/13 09:28, , 7F
12/13 09:28, 7F
→
12/13 12:46, , 8F
12/13 12:46, 8F
→
12/13 12:47, , 9F
12/13 12:47, 9F
→
12/16 09:18, , 10F
12/16 09:18, 10F
→
12/17 17:44, , 11F
12/17 17:44, 11F
→
12/17 17:45, , 12F
12/17 17:45, 12F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):