According to jdv's answer to another question, cotton swabs and isopropyl (rubbing) alcohol will do the trick. Try to keep the alcohol away from plastics, use it sparingly and be gentle when you rub the dirt.
His answer also says that "fancy contact cleaner" will work:
For example, "CRC QD Contact Cleaner". Make sure you don't get the type used for lubricating potentiometers. We want the quick drying, stable variety that doesn't leave a residue. [...]
Bonus: Good for cleaning keyboards, too.
(In this answer, he says that "plain old contact cleaner" will do for keyboards.)
The answer also forbids using erasers, but only on electrical contacts (because it wears them down). Rubbers should be fine on membrane-type contacts, provided that they haven't become brittle and you press lightly with a soft eraser.
If cleaning the keyboard doesn't fix it, it may be that the keys don't press on the little buttons. As suggested in this comment, if this is the case, placing a thin piece of felt underneath the keyboard mylar can allow them to "push" the buttons down far enough.