When sshing into an android phone, using any available editor such as nano will produce an error like:

Error opening terminal: screen.

Running the following exports in the shell will fix the issue (thanks to original solution posted here):

export TERMINFO=/etc/terminfo
export TERM=linux

Add to /etc/profile on the phone to make the settings permanent.