The Atomki collaboration has reported that unexpected excesses have been observed in the rare decays of Beryllium nucleus. It is claimed that such excesses can suggest the existence of a new boson, called X, with the mass of about 17 MeV. To solve the Atomki anomaly, we consider a model with gauged U(1)R symmetry and identify the new gauge boson with the X boson. We also introduce two SU(2) doublet Higgs bosons and one singlet Higgs boson, and discuss a very stringent constraint from neutrino-electron scattering. It is found that the U(1)R charges of the doublet scalars are determined to evade the constraint. In the end, we find the parameter region in which the Atomki signal and all experimental constraints can be simultaneously satisfied.