Pakhi
Pakhi

Reputation: 41

Unable to Import ScalarsConverterFactory

I have added

implementation 'com.squareup.retrofit2:converter-scalars:2.9.0' to gradle file.

But still I am not getting import option in my retrofit. ScalarsConverterFactory always shows error.

Retrofit retrofit =new Retrofit.Builder().baseUrl("http://192.168.1.1:9000").
addConverterFactory(ScalarsConverterFactory.create());

I tried changing versions of ScalarsConverterFactory() but no success.

Upvotes: 4

Views: 1548

Answers (2)

Phillip Crawford
Phillip Crawford

Reputation: 1

I was having the same issue as OP. Issue was solved by adding the following import statement to the kotlin file where I was calling ScalarsConverterFactory.create().

import retrofit2.converter.scalars.ScalarsConverterFactory

This allows our file to make use of the implementation in our Gradle Scripts

Upvotes: 0

Aghogho
Aghogho

Reputation: 1

Using kotlin dsl, if you have the same dependency you are using in gradle:

implementation("com.squareup.retrofit2:converter-scalars:2.9.0")

You should be able to get the library imported

Upvotes: 0

Related Questions