Selling your phone ? You have  to remember to remove more than just your custom case. Photographer: Balint Porneczi/Bloomberg

Selling your smartphone is a quick way to make some cash. But a study published earlier this week by the security firm Avast, in which the firm bought some used Android phones and recovered thousands of "erased" personal files, stands as a good reminder that you have to think carefully before you sell.

The study looked at 20 phones made by HTC, Motorola, Samsung and LG. According to Avast researchers reached Thursday, the phones ran several different versions of Android. Some, the company said, were running Android Gingerbread (version 2.3); most were at least up to Android Ice Cream Sandwich (versions 4.0.3-4.0.4).

Google said in a statement to The Washington Post that it doesn't believe that the study reflects the "security protections in Android versions that are used by the vast majority of users," given the older operating systems. According to the Android Developer's Web site, more than 74 percent of all Android users run some version of Android Jelly Bean (4.1- 4.3) or Android Kit Kat (4.4)

Regardless of your operating system, however, in addition to resetting it, here are some steps to take before selling or trashing your phone in order to keep your personal data protected.

1. Take out the SIM card. The SIM card in your phone is tied to your particular plan -- so there's no reason why the next owner should want it, and hanging on to it ensures that messages that messages sent to your old phone don't end up with someone else.

2. Have removable memory? Remove it. Many Android phones offer users the option of using an SD card to augment the amount of storage on their phones. Before you sell or get rid of your phone, be sure to take back any memory card you've put in, to make sure that your files stay with you.

3. Encrypt your data before you wipe it. Or just as a general rule. Encrypting your phone scrambles the data to make it unreadable to anyone who doesn't have the password to decrypt it. Any version of Android released in the past three years gives you the option to encrypt your data, normally through the security menu. (Different manufacturers may keep it in different spots.)

This is, in fact, the method that Google recommends for folks who want to get rid of their old phones. "If you sell or dispose of your device, we recommend you enable encryption on your device and apply a factory reset beforehand," the company said in a statement.