I’ve done it. It wasn’t as bad as I thought it would be. The only tricky part is that you have to set kernel to “none” in VM settings, unmount /dev/xvdd inside the template, and then (re)install the kernel and anbox, without rebooting between steps. I made the mistake of installing while /dev/xvdd was still mounted, and then unsurprisingly the anbox kernel modules disappeared upon reboot.
Also be careful not to stop the VM between setting kernel to “none” and reinstalling the kernel, or presumably the VM will be temporarily unbootable.
Finally, don’t forget to make the android image file persistent (and local to the AppVM rather than the TemplateVM) using bind-dirs.sh, if that’s how you intend to use it.
From what I remember, the rest was pretty much just like installing any other package.
You might want to make a clone of the Whonix template first and install anbox in the clone, so that you can easily start over if something goes wrong.