Skip to content
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

Unable to create converter for class #75

Open
mnayef95 opened this issue Dec 12, 2019 · 0 comments
Open

Unable to create converter for class #75

mnayef95 opened this issue Dec 12, 2019 · 0 comments
Labels

Comments

@mnayef95
Copy link

mnayef95 commented Dec 12, 2019

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

@koral-- koral-- added the bug label Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants