(改造)无法找到转换器类崩溃的应用程序 [英] (Retrofit) Could not locate converter for class crashing app
本文介绍了(改造)无法找到转换器类崩溃的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以改造2.0.0最近被释放,那里有没有真正了解如何使用它的任何更新的例子,但即时通讯试图实现它的一个基本的API调用。即时得到一个
So Retrofit 2.0.0 was recently released and theres not really any updated examples on how to use it, but im trying to implement it for a basic API call. Im getting a
java.lang.IllegalArgumentException: Unable to create converter for class`
引起
Caused by: java.lang.IllegalArgumentException: Could not locate converter for class orbyt.app.dataclass. Tried:
* retrofit.OkHttpBodyConverterFactory
在试图使API调用。
推荐答案
我面临同样的问题。我固定它通过添加:
I was facing the same issue. I fixed it by adding :
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
我build.gradle
to my build.gradle
然后创建我的改造实例时指定的转换器。
Then specify the converter when creating my Retrofit instance.
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Constants.API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
这篇关于(改造)无法找到转换器类崩溃的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文