Android Eclipse Error: "Gson could not be resolved to type"

I'm relatively new to Java, eclipse, and android, so this might be a completely stupid question, but I'm going to ask him about it.

I have a project that I am studying to check the connection to the flickr api and just display the latest images. I am now where I want to parse the JSON received from flickr. I downloaded gson 1.4 and added zip to the java build path through "add external banks". It has successfully loaded, and I see google-gson under the link libraries in the package explorer. My problem is that when I try to use it, I just get an error message.

Gson gson = new Gson ();

He highlights Gsson and says that "Gson cannot be resolved to type." What am I missing here? He worked once and has since ceased to exist. I tried to remove the banks, clean the project and re-add the banks, but it still does not work.

I just totally don't want this or is there another problem?

+2
source share
2 answers

I don’t know exactly why this worked, but I extracted the zip and just added gson-1-4.jar and it seems to work.

Hooray!

+8
source

A similar problem arose with me. The solution is to download the entire gson package, i.e. google-gson-1.6-release.zip instead of the streaming version, i.e. google-gson-stream-1.6.jar. It works great after unpacking the package and adding banners to the build path.

Cheers Mudit

+2
source

Source: https://habr.com/ru/post/1438542/


All Articles