Mass density of a solid sphere is ρ. Radius of the sphere is R. The gravitational field at distance r from the centre of the sphere inside it is
E(r)=GMR3r for r≤R=GR3(43πR3.ρr)=4Grπρ3