This will guide will help you to root XT1641 / XT1642 / XT1643 variants of the Moto G4 Plus. Before we proceed, let us have a look at the requirements.
First, let us unlock Moto G4 Plus bootloader
Head to Motorola website and register your E-Mail ID. Open Setting on your device and go to About Phone. Next, tap 7 times on Build Number and get the Developer Options unlocked. Head back to Main Settings Menu and go to Developer Options and switch the ‘Allow OEM Unlock’ option.
2- Getting Unique ID for each device
Reboot to Bootloader (power off, then press the power and volume down buttons simultaneously). On your desktop, open a command prompt or terminal, and go to the directory where you installed the Android SDK tools (or make sure mfastboot is in your $PATH) At the prompt, type
$ mfastboot oem get_unlock_data
You will get something like this:
On a Windows Desktop, the returned string format would be
$ fastboot oem get_unlock_data
On a Mac OS Desktop, the returned string format would be
Paste together the 5 lines of output into one continuous string without (bootloader) or ‘INFO’ or white spaces. Your string needs to look like this:
3- Unlocking the device
Check if your device can be unlocked by pasting this string in the specific field on the Motorola website, and clicking “Can my device be unlocked?” NOTE: If your device is unlockable, a “REQUEST UNLOCK KEY” button will now appear at the bottom of that page. Click on it and wait for the unique code to be sent to your mail. After you got the code type the following :
mfastboot oem unlock
and wait your device to reboot.
Root Moto G4 Plus using these instructions
1. Make sure you unlocked bootloader using instructions given above and have installed moto g4 plus twrp.
2. Download SuperSU and copy it into internal SD card.
3. Connect your phone with PC
4. Open Boot-loader on Phone. Extract Root-motog4-athena.zip and run ROOT.bat (it will flash custom boot.img)
5. Now Flash Supersu.zip From TWRP recovery.