我正在使用 gson 解析器(最新版本 -> 2.8.2).
I am using gson parser (latest version -> 2.8.2).
我想使用 RuntimeTypeAdapterFactory 这是 gson extras 的一部分.
I would like to use RuntimeTypeAdapterFactory which is part of the gson extras.
在我的 build.gradle 中,目前只有一个编译指令:
In my build.gradle there is currently a single compile directive:
compile 'com.google.code.gson:gson:2.8.2'
然而,这给了我只有 gson 库没有额外的(RuntimeTypeAdapterFactory 在项目中无法识别......).
However this gives me only the gson lib without the extras (RuntimeTypeAdapterFactory is not recognized in the project...).
我查看了 gson extras 的 pom 文件(https://github.com/google/gson/blob/master/extras/pom.xml)和尝试将以下行添加到我的构建 gradle:
I have looked at gson extras' pom file (https://github.com/google/gson/blob/master/extras/pom.xml) and tried to add below line to my build gradle:
compile 'com.google.code.gson:gson-extras:2.8.2'
但 gradle 只是不会编译 gson 附加功能:
But gradle just won't compile the gson extras:
"Error:Failed to resolve: com.google.code.gson:gson-extras:2.8.2"
任何想法如何使这项工作?
Any Idea how to make this work?
非常感谢您在此问题上的时间和帮助.
Thank you very much for your time and assistance in this matter.
错误:无法解决:com.google.code.gson:gson-extras:2.8.2
Error:Failed to resolve: com.google.code.gson:gson-extras:2.8.2
额外的包未在 Maven 中发布.
您可以检查这些问题:
如您所见,此包尚未发布,使用其中的类的最佳方法是在您的项目中包含源代码.
As you can read this package is not published and the best way to use the classes inside is just to include source-code in your project.
这篇关于如何将 Gson 附加功能添加到 Android 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
更新到 Android Build Tools 25.1.6 GCM/FCM 后出现 IncompIncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出现 Incompatible
如何在 gradle 中获取当前风味How to get current flavor in gradle(如何在 gradle 中获取当前风味)
如何修复“意外元素<查询>在“清单How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修复“意外元素lt;查询gt;在“清单中找到错误
基于 Android Gradle 中多风味库的多风味应用Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多风味库的多风味应用)
Android 依赖在编译和运行时有不同的版本Android dependency has different version for the compile and runtime(Android 依赖在编译和运行时有不同的版本)
本地 aar 库的传递依赖Transitive dependencies for local aar library(本地 aar 库的传递依赖)