Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Eclipse Error: "Gson cannot be resolved to a type"

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?

like image 388
mattmcmanus Avatar asked Jul 04 '26 07:07

mattmcmanus


1 Answers

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!

like image 77
mattmcmanus Avatar answered Jul 05 '26 22:07

mattmcmanus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!