yongjhih / NotRetrofit

Type-safe REST client for Android and Java
Apache License 2.0
93 stars 12 forks source link

IllegalArgumentException: Unable to create converter for java.util.List<ModelClass> when using SimpleXmlConverter with retrofit 2.0 #16

Open prince1389 opened 8 years ago

prince1389 commented 8 years ago

Usage

private Retrofit mRetrofit = new Retrofit.Builder()
                .baseUrl("http://www.w3schools.com")
                .addConverterFactory(SimpleXmlConverterFactory.create())
                .build();

Service class

public interface Food{
 @GET("/xml/simple.xml")
    Call<List<FoodId>> getFoodIdType();
}

Model class

@Root(name = "Food")
    public class Food{
        @Element(name = "id")
        private int id;
        @Element(name = "description")
        private String description;
        public Food(){

        }
}

Gradle config

compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile ('com.squareup.retrofit2:converter-simplexml:2.0.0') {
    exclude module: 'stax'
    exclude module: 'stax-api'
    exclude module: 'xpp3'
}

Side note: I was able to make it work with GsonConverterfactory, when used a different url.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/33976556-illegalargumentexception-unable-to-create-converter-for-java-util-list-modelclass-when-using-simplexmlconverter-with-retrofit-2-0?utm_campaign=plugin&utm_content=tracker%2F8327951&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F8327951&utm_medium=issues&utm_source=github).
yongjhih commented 8 years ago

Sorry, it's not supported retrofit2