Tuesday, January 28, 2020

Fixing gboard (google keyboard) voice input problem on android 9/10

Here's the problem: tap the microphone icon in gboard (aka google keyboard) and it responds like it can hear you, including the "VU" moving back and forth like the microphone is picking up the volume change between talking and silence. BUT: the expected text never shows up. It never transcribes your voice to text, or it only works 1 time out of 10. It took me a long while to fix this problem, but I finally did, though it requires ADB and a trusted source of an old keyboard APK.

I thought this was a Samsung problem since it showed up on my Note 10 first. Maybe something to do with Bixby, "the worst voice assistant for your phone, ever(TM)". I was hopeful that upgrading from android 9 to 10 would fix it, but no dice there either. I tried all the suggestions online but those were all pretty obviously irrelevant since the microphone was picking up sounds, just not transcribing.

Then the breakthru: my LG Stylo 5 started to have the problem too. For once I couldn't blame Bixby. So there must be a bug in the gboard app itself. Of course I had already tried reinstalling it, clearing cache, and even factory resetting my Note 10 (spoiler: no help).

So how about "downgrading" to an older version of the google keyboard? I'd never had a problem with my other phones. Indeed this is the solution, but not an easy one.

Getting an old version of the keyboard can be done one of two ways. For phone hoarders like myself you can extract the APK from your old phone and then copy it to your new phone. This only gives only a few versions to choose (at most, as many as the phones you own) . I went a different route: apkmirrror which I consider to be trustworthy enough (run by the same folks who do android police). Your keyboard touches lots of sensitive things (passwords!) so you'll have to convince yourself.

The version of the gboard app that I found to work properly was  Google Keyboard Versions as new as 8.3.6 still had intermittent problems, so I guess this is a long standing bug but for some reason it doesn't get triggered until android 9/10. I didn't search exhaustively, but frankly, has gboard really gotten any better in the last 2 years? Just grab the version I did and get on with it!

Next: downgrading a currently installed app is not trivial. In fact it cannot be done from your phone directly, which is a big issue if your phone came with gboard already installed (like my stylo 5 does). If you can uninstall gboard then it's easy to install the old version: copy the apk to your phone, and open it with a file browser. Tell android to allow the app to install unsigned APKs, and continue. I won't go into details since sideloading is pretty well known.

So what if you can't get rid of the newer copy of gboard? It's not that hard but you'll have to install adb on your PC and put your phone in developer mode. If you don't know how, it's too many steps to include here, but google "install ADB", "android developer mode", and finally "usb debugging". Now plug your phone, and two start cmd.exe in the same folder as teh adb.exe.

First, place the proper apk (I renamed it gboard.apk) on your phone in an accessible folder (not downloads).

adb push t:\gboard.apk /data/local/tmp

Then tell your phone to install the apk, allowing for downgrades:

 adb shell pm install -r -d /data/local/tmp/gboard.apk

At the command line you should see "Success".

if you see something like this: "avc:  denied  { read } for  scontext=u:r:system_server:s0 tcontext=u:object_r:sdcardfs:s0 tclass=file permissive=0
System server has no access to read file context u:object_r:sdcardfs:s0 (from path /sdcard/gb.apk, context u:r:system_server:s0)" then you didn't place the APK in a folder that PM (package manger) is allowed to install APKs from.

Now check from inside gboard that you have the old 7.9.7 version, and not the new buggy one that you previously had. Everything should work perfectly, just like it did before google screwed it up. Yay for "progress".