gpt4 book ai didi

android - 无法解析符号 GsonConverterFactory

转载 作者:行者123 更新时间:2023-12-03 02:46:44 24 4
gpt4 key购买 nike

如果我尝试使用 GsonConvertFactory,我会收到此错误消息:

Cannot resolve Symbol GsonConverterFactory



我这样使用它:
    return new Retrofit.Builder()
.baseUrl(BASE_URL)
.client(client)
//.addConverterFactory(MoshiConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson))
.build();

这是我的 gradle 文件(模块:app):
dependencies {
...
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
compile 'com.google.code.gson:gson:2.7'
}

最佳答案

GsonConverterFactory位于以下依赖项中,因此,将其添加到您的 build.gradle作为依赖。

compile 'com.squareup.retrofit2:converter-gson:2.3.0'

关于android - 无法解析符号 GsonConverterFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45306240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com