Reputation: 1796
I'm relatively new to Java, eclipse and android so this could be a completely silly question, but I'm going to ask it none the less.
I've got a project I'm learning with to test connecting to the flickr api and simply displaying recent images. I'm at the point now where I want to parse the JSON received from flickr. I've downloaded gson 1.4 and added the zip to the java build path through "add external jars." It's successfully loaded and I can see google-gson under referenced libraries in the package explorer. My problem is, when I try to use it, I simply get an error.
Gson gson = new Gson();
It highlights Gson and says that "Gson cannot be resolved to a type." What am I missing here? It worked once and has since stopped. I've tried removing the jars, cleaning the project and re-adding the jars but it still doesn't work.
Am I just completely noobing this up or is there another problem?
Upvotes: 3
Views: 15056
Reputation: 4213
Same problem occurred with me too. The solution is to download the entire gson package ie. google-gson-1.6-release.zip instead of stream only version ie google-gson-stream-1.6.jar. It works fine after you unzip the package and add the jars in your build path.
Cheers Mudit
Upvotes: 2
Reputation: 1796
I'm not sure exactly why this worked but I extracted the zip and just added gson-1-4.jar and it appears to have worked.
Hooray!
Upvotes: 9