Android chambre persistante de la bibliothèque - TypeConverter erreur de erreur: Impossible de trouver comment sauver champ de base de données"

Je ne suis pas en mesure de créer un typeConverter dans la chambre en raison d'une erreur. Je semble être la suite tout par les docs. Je voudrais convertir une liste à une chaîne json. permet de jeter un coup d'oeil à mon entité:

      @Entity(tableName = TABLE_NAME)
public class CountryModel {

    public static final String TABLE_NAME = "Countries";

    @PrimaryKey
    private int idCountry;
/* I WANT TO CONVERT THIS LIST TO A JSON STRING */
    private List<CountryLang> countryLang = null;

    public int getIdCountry() {
        return idCountry;
    }

    public void setIdCountry(int idCountry) {
        this.idCountry = idCountry;
    }

    public String getIsoCode() {
        return isoCode;
    }

    public void setIsoCode(String isoCode) {
        this.isoCode = isoCode;
    }

    public List<CountryLang> getCountryLang() {
        return countryLang;
    }

    public void setCountryLang(List<CountryLang> countryLang) {
        this.countryLang = countryLang;
    }

}

La country_lang est ce que je voudrais convertir une chaîne json. J'ai donc créé le convertisseur suivants:
Converters.java:

public class Converters {

@TypeConverter
public static String countryLangToJson(List<CountryLang> list) {

    if(list == null)
        return null;

        CountryLang lang = list.get(0);

    return list.isEmpty() ? null : new Gson().toJson(lang);
}}

alors le problème, c'est partout où j'ai mis le @TypeConverters({Converters.class}) je reçois un message d'erreur. Mais officiellement, c'est là où j'ai placé l'annotation pour obtenir le typeConverter enregistré:

@Database(entities = {CountryModel.class}, version = 1 ,exportSchema = false)
@TypeConverters({Converters.class})
public abstract class MYDatabase extends RoomDatabase {
    public abstract CountriesDao countriesDao();
}

L'erreur que j'obtiens est:

Error:(58, 31) error: Cannot figure out how to save this field into database. You can consider adding a type converter for it.
avez-vous un convertisseur de String à List<CountryLang>? Je ne vois pas dans votre code. La chambre devra ainsi être en mesure de lire les données en arrière.
J'ai essayé, mais je préfère ne pas les aider. Même erreur
TypeConverter pour les listes ne fonctionne pas. Si cela ne fonctionne pas pour vous, vous avez sans doute oublier d'ajouter une méthode pour la conversion inverse. @TypeConverter public static List<CountryLang> jsonToCountryLang(String json)

OriginalL'auteur j2emanue | 2017-06-16