Reputation: 4695
I'm trying to get a Play! app to get data from Youtube via the GData API. Following the Youtube guide I added
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;
To the top of my file then created my class
public class Videos extends Controller {
//...Irrelevant stuff...
public static void create(@Required String video_id) {
if (validation.hasErrors()) {
render("Videos/submit.html");
}
YouTubeService service = new YouTubeService("app", "abcd");
String videoEntryURL = "http://gdata.youtube.com/feeds/api/videos/"+video_id;
VideoEntry videoEntry = service.getEntry(new URL(videoEntryURL), VideoEntry.class);
System.out.println(videoEntry.getTitle().getPlainText());
}
//...Irrelevant stuff...
}
I'm getting the following error from Play
Compilation error
The file /app/controllers/Videos.java could not be compiled. Error raised is : The type com.google.gdata.client.media.MediaService cannot be resolved. It is indirectly referenced from required .class files In /app/controllers/Videos.java (around line 40)
40: VideoEntry videoEntry = service.getEntry(new URL(videoEntryURL), VideoEntry.class);
In the browser and
play.exceptions.CompilationException: The type com.google.gdata.client.media.MediaService cannot be resolved. It is indirectly referenced from required .class files at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:474) at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:278) at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:412) at play.Play.start(Play.java:485) at play.Play.detectChanges(Play.java:599) at play.Invoker$Invocation.init(Invoker.java:186) at Invocation.HTTP Request(Play!)
From the command line.
I've only recently started using Play! but this error has me stumped =/
I've added the two required librarys from the GData api to the /lib/ folder of my Play! app, the guide I'm following for the GData API is here
Upvotes: 1
Views: 1242
Reputation: 2785
com.google.gdata.client.media.MediaService is in the gdata-media-[version].jar. In my projects, I have five gdata jars: gdata-base, gdata-client, gdata-media, gdata-youtube, and gdata-core.
Upvotes: 1