Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
prince1389 opened this issue May 6, 2016 · 1 comment

Comments

@prince1389
Copy link

prince1389 commented May 6, 2016

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
Copy link
Owner

yongjhih commented May 6, 2016

Sorry, it's not supported retrofit2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants