Gmail: "Setup could not finish"

I’m trying to add a Gmail account to K-9 (currently using whatever latest beta is, on Android 11).

This is a new Gmail account and I thought I would try IMAP (all my other accounts in K-9 are POP3). Enabled in gmail settings on computer.

When I add the account to K-9, for Incoming Server Settings, it’s auto populated the right info according to gmail (, Security=SSL/TLS, Port=993, Username=[my email address], Authentication=Normal password, Password=[correct password], Auto-detect IMAP namespace is checked, and Use compression on all networks).

When I press Next, I get this error:

Setup could not finish
Username or password incorrect. (Command: sensitive; response: #3# [NO, [AUTHENTICATIONFAILED], Invalid credentials (Failure)])

with a choice of Continue or Edit Details.

Am I doing something wrong? I’ve never used IMAP and I’m okay with doing this on POP3, but this seems a good opportunity to learn IMAP on a (hopefully) low-volume Gmail account.


With gmail you need to use an “app password” and allow “less secure apps” on your account. See:

for details. Your google/gmail login credentials will not work when using K-9.

[you will find your version number under settings/about.]

Thank you. It looks like if I use an app password, every time K-9 accesses my Gmail account I’ll get a passcode I have to enter? Or is it just occasional? I’m happy to do that when I go to my bank’s site, but it doesn’t make sense for background email checking (though I can imagine Google doing it to force people to their apps).

The app password is a permanent password that you set up on the gmail side and then use when configuring K9, which will save it. It’s not a one-time/2fa password.

From other comments, you may need to set the google/gmail account to use 2fa before it will let you set up app passwords, but the app using an app password doesn’t use 2fa.

Thank you, that fixed it. They certainly make it more work that just using gmail app (I guess that’s part of the idea). And it definitely looks like 2FA has to be turned on. I was going to post the link but I closed the browser tab and now can’t get back there.

When K-9 supports XOAUTH2 these app-password/less-secure app steps won’t be necessary. It appears that support for that is moving forward, but may be a bit still.

Now that it’s set up it’s transparent to me, though if I change devices I’m guessing I’ll need to do it again.

Thanks all for your help.

if you remember the “app password” you set up you can use it on another device. nothing more needed.