android - Gson库的引用
黄舟
黄舟 2017-04-17 17:32:14
0
4
493

项目中用到了retrofit网路请求框架,然后json解析系添加了
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
感觉已经够用了,但是为什么看到有的项目中还要添加gosn库
compile 'com.google.code.gson:gson:2.6.2'

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(4)
小葫芦

The one above is a package repackaged by retrofit itself, while the bottom one is Google’s official GSON package. A situation often occurs where retrofit is used, and then some third-party projects are used that rely on official Gson development projects, and then there is no All methods can only be used. This is a problem that often occurs when using third-party open source projects.

Ty80

You should just pass the code that references converter-gson:2.1.0'. It may be that the compilation tool defaults to using Google's gson package after seeing gson.

Ty80

Default relies on gson and uses gson to parse json. You no longer need to reference the gson library separately

迷茫

1. The dependency of converter-gson is transparently transmitted, so that the dependency of gson is automatically added.
2. You can use @aar to turn off transparent transmission

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template