2

My target is to use youtube instead of server, to store videos. I need youtube provide the following function 1. upload video and get his url . 2. search for video that match developer tag.

to do so, i find here those posts

Using YouTube Data Api in Android

Creating a playlist with Youtube DATA API on Android

after i read those posts i install eclipse youtube data plug in

and downloaded those file

https://code.google.com/p/gdata-java-client/downloads/detail?name=gdata-samples.java-1.47.1.zip&can=2&q=

gdata-samples.java-1.47.1
mail.jar
activation.jar
servlet-api.jar

as mention here https://developers.google.com/gdata/articles/eclipse?hl=iw

those zip file i add to libs folder on my android project exactly like youtube mention in the link above...

to my project i add internet permission, import packages, and add this line : YouTubeService service = new YouTubeService(clientID, developer_key);

like mention here : https://developers.google.com/youtube/2.0/developers_guide_java?hl=iw#Authentication

in this time my project look like this :

package com.example.youtubeuploaddata;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

import com.google.gdata.client.*;
import com.google.gdata.client.youtube.*;
import com.google.gdata.data.*;
import com.google.gdata.data.geo.impl.*;
import com.google.gdata.data.media.*;
import com.google.gdata.data.media.mediarss.*;
import com.google.gdata.data.youtube.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.io.IOException;
import java.io.File;
import java.net.URL;


public class YoutubeUploadData extends Activity {


    String clientID = "xxxxxxxxxxxxxxx";
    String developer_key = "xxxxxxxxxxxxxxxxxxxxxxx";


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_youtube_upload_data);


        YouTubeService service = new YouTubeService(clientID, developer_key);


    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.youtube_upload_data, menu);
        return true;
    }


 }

and my project contein this jar enter image description here

at this time i test the app on my device and recieve those errors :

05-01 21:10:43.993: W/dalvikvm(12171): Unable to resolve superclass of               Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:43.993: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:43.993: W/dalvikvm(12171): VFY: unable to find class referenced in signature (Lcom/google/gdata/util/common/net/UriParameterMap;)
05-01 21:10:43.993: W/dalvikvm(12171): Unable to resolve superclass of Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:43.993: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:43.993: W/dalvikvm(12171): VFY: unable to find class referenced in signature (Lcom/google/gdata/util/common/net/UriParameterMap;)
05-01 21:10:43.993: W/dalvikvm(12171): Unable to resolve superclass of Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:44.003: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:44.003: W/dalvikvm(12171): VFY: unable to resolve static field 2621 (EMPTY_MAP) in Lcom/google/gdata/util/common/net/UriParameterMap;
05-01 21:10:44.003: W/dalvikvm(12171): Unable to resolve superclass of Lcom/google/gdata/util/common/net/UriParameterMap; (26)
05-01 21:10:44.003: W/dalvikvm(12171): Link of class 'Lcom/google/gdata/util/common/net/UriParameterMap;' failed
05-01 21:10:44.003: W/dalvikvm(12171): VFY: unable to resolve static method 8229: Lcom/google/gdata/util/common/net/UriParameterMap;.parse (Ljava/lang/String;)Lcom/google/gdata/util/common/net/UriParameterMap;
05-01 21:10:44.033: W/dalvikvm(12171): VFY: unable to resolve static method 65: Lcom/google/common/collect/Maps;.newHashMap (Ljava/util/Map;)Ljava/util/HashMap;
05-01 21:10:44.033: W/dalvikvm(12171): VFY: unable to resolve static method 64: Lcom/google/common/collect/Maps;.newHashMap ()Ljava/util/HashMap;
05-01 21:10:44.033: W/dalvikvm(12171): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/gdata/client/Service;
05-01 21:10:44.033: W/dalvikvm(12171): threadid=1: thread exiting with uncaught exception (group=0x40d9f1f8)
05-01 21:10:44.043: E/AndroidRuntime(12171): FATAL EXCEPTION: main
05-01 21:10:44.043: E/AndroidRuntime(12171): java.lang.ExceptionInInitializerError
05-01 21:10:44.043: E/AndroidRuntime(12171):    at com.example.youtubeuploaddata.YoutubeUploadData.onCreate(YoutubeUploadData.java:55)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.app.Activity.performCreate(Activity.java:4519)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.os.Looper.loop(Looper.java:137)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at android.app.ActivityThread.main(ActivityThread.java:4464)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at java.lang.reflect.Method.invokeNative(Native Method)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at java.lang.reflect.Method.invoke(Method.java:511)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:589)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at dalvik.system.NativeStart.main(Native Method)
05-01 21:10:44.043: E/AndroidRuntime(12171): Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.Maps
05-01 21:10:44.043: E/AndroidRuntime(12171):    at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:118)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:100)
05-01 21:10:44.043: E/AndroidRuntime(12171):    at com.google.gdata.client.Service.<clinit>(Service.java:555)
05-01 21:10:44.043: E/AndroidRuntime(12171):    ... 15 more

in this state i understand that, youtube data not work on android project what i need to do to order this target???

please help...

Community
  • 1
  • 1
idan
  • 1,508
  • 5
  • 29
  • 60

2 Answers2

2

Your problem is this:

Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.Maps

com.google.common.collect.Maps is not found. You ether missing a library or have some problem with the manifest.

Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216
1

Feel free to go through my example open source project, it utilizes Data API v3 for this.. https://code.google.com/p/ytd-android/

Ibrahim Ulukaya
  • 12,767
  • 1
  • 33
  • 36
  • at the time i add the project i receive message " built path contains duplicate entry 'src' for project "Youtube Direct ..." and when the project already in eclipse many compailer error that i do not know how to fix them appear, do you know how to fix it ? . thank you for your help... – idan May 03 '13 at 15:56
  • You don't need the whole project, you can just use UploadService.java and ResumableUpload.java If you want to run the whole project, do git clone, then update Maven dependencies and link to google play services, it's all explained in home page – Ibrahim Ulukaya May 03 '13 at 16:24
  • thank you I really appreciate it, I deleted you mentioned, still has bugs I sat on the project in the coming days to know him and make him work. – idan May 03 '13 at 17:21
  • I do not Success to run this Android project, Would you please tell me how to make the project run on Android..., even just the part of uploading to YouTube http://stackoverflow.com/questions/16375568/how-to-upload-video-to-youtbue-using-youtube-direct-lite-app-for-android – idan May 04 '13 at 21:18