Java GsonConverter未解析

Java GsonConverter未解析,java,android,gradle,gson,retrofit,Java,Android,Gradle,Gson,Retrofit,我在我的build.gradle文件中添加了这个 build.gradle compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4' compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4 但改装2的GsonConverter仍然没有解决。您还必须在gradle dependencies中添加gson compile 'com.squareup.retrofit2:retro

我在我的
build.gradle
文件中添加了这个

build.gradle

  compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
  compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4

但改装2的GsonConverter仍然没有解决。

您还必须在gradle dependencies中添加
gson

compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0' 
compile 'com.google.code.gson:gson:2.6.2' // this should also be there
并创建如下改装实例:

public static final String BASE_URL = "http://api.example.com/";
Retrofit retrofit = new Retrofit.Builder()
    .baseUrl(BASE_URL)
    .addConverterFactory(GsonConverterFactory.create())
    .build();

您还必须在gradle dependencies中添加
gson

compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0' 
compile 'com.google.code.gson:gson:2.6.2' // this should also be there
并创建如下改装实例:

public static final String BASE_URL = "http://api.example.com/";
Retrofit retrofit = new Retrofit.Builder()
    .baseUrl(BASE_URL)
    .addConverterFactory(GsonConverterFactory.create())
    .build();

为什么不使用稳定的版本

compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'

为什么不使用稳定的版本

compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'

嘿,即使我也面临同样的问题,添加下面的行也不起作用

compile 'com.squareup.retrofit2:converter-gson:2.0.0'
然后我去maven存储库下载jar并粘贴到android studio的libs文件夹中。链接如下:

[https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22converter-gson%22][1]
然后将下面的行添加到渐变

compile files('libs/converter-gson-2.0.1.jar')
    compile 'com.google.code.gson:gson:2.6.2'

嘿,即使我也面临同样的问题,添加下面的行也不起作用

compile 'com.squareup.retrofit2:converter-gson:2.0.0'
然后我去maven存储库下载jar并粘贴到android studio的libs文件夹中。链接如下:

[https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22converter-gson%22][1]
然后将下面的行添加到渐变

compile files('libs/converter-gson-2.0.1.jar')
    compile 'com.google.code.gson:gson:2.6.2'

我添加了:编译'com.google code.gson:gson:2.5'但仍然不起作用。你能发布吗?你是如何创建改装实例的?不管怎样,你能发布吗?还有post
build.gradle
file.add
build.gradle
file.Let.us.我已经添加了:compile'com.google code.gson:gson:2.5'但仍然不起作用你能发布吗,你是如何创建改装实例的?不管怎样,你能发布吗?还有post
build.gradle
file.add
build.gradle
file.Let.us.我下载了converter-gson-2.1.0-sources.jar,但仍然不工作:(我下载了converter-gson-2.1.0-sources.jar,但仍然不工作:(