How do I setup a Gmail account with 2-step verification in K-9 Mail? I'm trying to setup my Gmail account in K-9 Mail, but when I'm setting up the incoming server, I keep getting the error: "Wrong username or password". When I'm trying to set up an outgoing server, I get an error which directs me to the two-step verification at Google.

I have 2-step verification configured on my Google account, but can't seem to get this into K-9 Mail. I've searched all over and tried following different guides, e.g. this question, and I've also tried to change the password on my Google account but nothing helped.

How can I properly configure K-9 Mail for my Gmail account with 2-step verification?
IMAP clients generally need to use application-specific passwords in order to access accounts that use 2-step verification. You'll need to generate a new app-specific password, then use that to set up your incoming/outgoing servers instead of using your regular account password. Google's support page (linked above) includes instructions for doing this. Summarized, the procedure is:

How to generate an application-specific password

Visit your Google Account settings page.
On the left, click Security.
Under the &quot;Signing in to Google&quot; topic, click App Passwords.
Using the dropdown menus within under the App Passwords section,  select which application you would like to generate a
password for along with the device then click &quot;GENERATE&quot;. You'll then
see the application-specific password (ASP) you just created along
with instructions on how to use it.
When you sign in to an application requiring an ASP, enter your ASP in the password field, and make sure you check the &quot;Remember password&quot;
option if you want the application to remember the code.