Make serializer injectable

e.g. for android compatibility