Skip to content

Unable to create converter for class #75

Description

@mnayef95

To Reproduce
Steps to reproduce the behavior:

  1. Add retrofit converter version 1.3.2
  2. Add these classes
data class JobsWrapper(

    @Selector(".conference-list li")
    val jobs: List<Job>? = null
)
@Entity(tableName = "jobs")
data class Job(

    @Selector("li .open-trigger strong")
    val title: String? = null,

    @Selector("li .open-trigger small")
    val location: String? = null,

    @Selector("li p.hidden")
    val description: String? = null,

    @PrimaryKey
    @Selector("li a")
    val url: String = ""
)
  1. Add converter to retrofit
@Provides
@Singleton
fun provideHtmlRetrofit(okHttpClient: OkHttpClient): Retrofit {
    return Retrofit.Builder()
        .baseUrl(BuildConfig.JOBS_BASE_URL)
        .client(okHttpClient)
        .addConverterFactory(JspoonConverterFactory.create())
        .build()
}
  1. Add GET method to service interface
@GET("jobs")
suspend fun getAllJobs(): JobsWrapper

Expected behavior
Converter created successfully and everything working fine.

Actual behavior

java.lang.IllegalArgumentException: Unable to create converter for class net.androidweekly.data.models.jobs.JobsWrapper
    for method RemoteJobsDao.getAllJobs

I have tried to use version 1.0.0 it's working fine but the problem with 1.3.2

Retrofit version: 2.7.0

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions