implementation 'com.squareup.retrofit2:converter-gson:<latest-version>'
可以在这里找到最新版本。
只需粘贴此即可:
实现“com.google.code.gson:gson:2.8.5”
实现'com.squareup.retrofit2:retrofit:2.6.1'
使用(如果可能)最新版本,我遇到了同样的错误,但看起来改造'com.squareup.retrofit2.converter-gson:2.3.0'版本2.3.0已弃用。
这对我有用:
//Retrofit2
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
来源:
效果非常好。
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
它提供/提供您需要的最新存储库。
在我使用之前似乎没有什么对我有用:
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version = "2.9.0" } gson = { group = "com.google.code.gson", name = "gson", version = "2.10.1" } 转换器= {组=“com.squareup.retrofit2”,名称=“converter-gson”,版本=“2.9.0”} 在我的 .toml 文件中。