Install Gson from Github

老子叫甜甜 提交于 2019-12-09 16:50:30

问题


I'm just starting to learn Java and I need Gson for a new project that I'm working on.

I feel like I'm missing something with all the installation instructions that I find online--all of them refer to three jar files that I should be able to extract from a zip file. But when I look at Gson on github i can't find any .jar files!

https://github.com/google/gson

Once I find the jar files, I'm just supposed to include them in the buildpath for the project I'm working on right?

I'm working on this project using Eclipse.

Can someone help me with a very simple step-by-step explanation of how to start including these libraries for a complete noob to programming like me?

Also, once I include the .jar files in the buildpath for a project, can I just call the functions?


回答1:


Simple put all jar files in your project lib folder Right Click on your Project->Properties-> Java Build Path->Libraries and you can download Gson from here If you looking for some specific version please add in your question

http://www.java2s.com/Code/Jar/g/Downloadgson222jar.htm




回答2:


  1. Find out the latest version(2.3.1) by this time, from the MAVEN central repository.
  2. You can find the step by step procedures to add jars to your project from this step by step "How to Add JARs to Project Build Paths in Eclipse (Java)"?



回答3:


as you are using Gson for serialization and deSerialization of json data you have to include Gson lib from here. on the other end, with Android Studio you can include the following line to your gradle:

 compile 'com.google.code.gson:gson:2.3.1'

Then you will be able to call Gson in-builds method and constructor like:

1 - Gson gson = new Gson();

2 - gson.fromJson();

3 - gson.toJson();

enjoy your code :)-



来源:https://stackoverflow.com/questions/31829001/install-gson-from-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!