What do you mean exactly that it 'turns off'?
If you have installed multiple keyboards to the device, it may be a conflict. Or it could be something else (bad app, virus, malware, etc.) that is causing the problem. I would suggest first removing all the extra keyboards that were installed. Then update the google one and restart the phone. Should this not help, try starting up the phone in "Safe Mode". While many apps won't work in that mode, you will be able to access some and test if the keyboard works OK. If it works fine in "Safe Mode" then it is something on the phone that is the cause and you will need to remove the item causing the issue to resolve it.
To get into "Safe Mode" please do the following.
1. First turn off the...