0

I am trying to hook up the youtube api for an android app, i downloaded all the required jars and started to follow the examples at https://developers.google.com/youtube/2.0/developers_guide_java#Retrieving_and_searching_for_videos.

I tried putting in

"YouTubeService service = new YouTubeService(clientId,develober_key)" and "service.setUserCredentials("user@gmail.com", "mypassword");". 

When i try to run the app i get a forceclose with the error message "06-24 21:27:24.286:

E/AndroidRuntime(10191): java.lang.NoClassDefFoundError: com.google.gdata.client.youtube.YouTubeService"

Which i see is included in my reference libraries folder. Could there be something wrong with the class, or am i missing something?

All I want to do is show a list of my videos inside of a listview on an android application. Am I missing any requirements? What further steps do I have to take to get the authentication running? Is there a simpler way to do this?

Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
Christian
  • 958
  • 5
  • 23
  • 52

2 Answers2

0

That comes under the Google APIs section. Change the build target to Google APIs under

Project Properties > Android

Also, verify that the gdata libraries are not included multiple times. Clean project, include the libraries again and try again.

Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
  • I Switched it over to GoogleAPIs and I am getting the same forceclose. is there somthing that I should be putting inside of the manifest? I am using Google APIs android 1.5 if that helps – Christian Jun 26 '12 at 03:53
0

From http://code.google.com/p/google-api-java-client/wiki/Setup

It is said : WARNING: for Android, the jars MUST be placed in a directory named "libs" for the APK packager to find them. Otherwise, you will get a NoClassDefFoundError at runtime.

I didn't used that API though but this one :

https://developers.google.com/youtube/2.0/developers_guide_protocol_audience

After manually moving the jars in the lib folder it worked.

Ludovic
  • 1,294
  • 1
  • 8
  • 3