Cannot access ‘‘: it is private in ‘MoshiConverterFactory’ //Android Kotlin Dev Diary

Written by

on

in

, ,

I’m starting a new category on my blog — Dev Diary, to document some of the errors that I encounter and what I did to fix them. I’m doing this in hopes of helping developers (including my future self!) as they work with code (and to get more blog visits! LOL). It’s nice to save time fixing a problem that you have already encountered and fixed before.

Today’s problem:

You are creating an instance of a class such as MoshiConverterFactory, but you get an error that says Cannot access '<init>': it is private in 'MoshiConverterFactory'

The solution:

Use the .create() method of the MoshiConverterFactory, like so:

.addConverterFactory(MoshiConverterFactory.create(moshi))

Related Posts

About the author:

Catzie Avatar

The homo sapiens behind these blog posts is “Catzie“

Explore my top blog posts:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *