A search is presented for resonant production of second-generation sleptons ( , ) via the R-parity-violating coupling to quarks, in events with two same-sign muons and at least two jets in the final state. The smuon (muon sneutrino) is expected to decay into a muon and a neutralino (chargino), which will then decay into a second muon and at least two jets. The analysis is based on the 2016 data set of proton-proton collisions at recorded with the CMS detector at the LHC, corresponding to an integrated luminosity of 35.9 . No significant deviation is observed with respect to standard model expectations. Upper limits on cross sections, ranging from 0.24 to 730 , are derived in the context of two simplified models representing the dominant signal contributions leading to a same-sign muon pair. The cross section limits are translated into coupling limits for a modified constrained minimal supersymmetric model with as the only nonzero R-parity violating coupling. The results significantly extend restrictions of the parameter space compared with previous searches for similar models.