[Moto G4 Plus Guides, News, & Discussion] rajatgupta1998:
Disclaimer: I am not responsible for anything that happens as a result of flashing these files.

Latest Build Nougat:NPJS25.93-14-18 Tested on: All retail variants: XT1621, XT1622, XT1640, XT1641, XT1642, XT1643, XT1644

Latest Build Oreo: OPJ28.111-22-1 Tested on: All retail variants: XT1621, XT1622, XT1640, XT1641, XT1642, XT1643, XT1644

Note: Motorola doesn't allow downgrading so once u flash O via OTA/Fastboot it isn't recommended to go back to N or any older build than OPJ28.111-22 .

Downloads:

Stock N: ATHENE_NPJS25.93-14-18_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

Stock O: ATHENE_OPJ28.111-22-1_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

Note: If you're looking for a TWRP flashable version instead, please download that zip from the thread below, thanks to [MENTION=4481495]Jleeblanch[/MENTION] for providing this zip. Keep in mind that you can't take OTAs on this version as you'll be having TWRP and these zips don't upgrade your bootloader/gpt.

[ROM] TWRP Flashable Stock Firmware [7.0][8.1.0]

Procedure:

You must already have ADB and fastboot setup, check here if you haven't already as using adb/fastboot isn't within the scope of this thread.

How to Install ADB on Windows, macOS, and Linux

1. Download the file and extract the zip archive

2. Extract all the files to your fastboot folder. (Not needed if you have adb and fastboot added to the path, if you want to know how to do this, check this guide: How to Use ADB or Fastboot From Any Directory on your Windows/Linux PC)

3. Restart the device in fastboot/bootloader mode and connect to your PC.

4. Make sure the system detects the device in fastboot mode, to verify this your command window/terminal shows a serial number when you type:

fastboot devices

5. Use the following commands now or you can use the flash scripts provided as attachments to this post:

NOTE: SKIP the oem lock begin and the oem lock commands if you dont want to lock your bootloader

Linux users will need to change the extension to .sh and add sudo before each command or directly run it as a root user .

To simply flash, run the "OEM Flash" file; to lock the bootloader, run "OEM Lock" file.

Manual method:

fastboot oem lock begin
fastboot oem lock begin
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash dsp adspso.bin
fastboot flash oem oem.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize (optional: will erase any customizations if ordered through motomaker)
fastboot erase clogo (optional: will erase the custom boot logo if ordered through motomaker)
fastboot oem lock
fastboot reboot

Note: Many people have reported than flashing stock ROM after flashing a 64 bit Pie custom ROM leads to loss of IMEI. Just in case this happens to you, the fix has been made available by [MENTION=6490709]Heeth21[/MENTION] . Also, some people suffer from having messed up Baseband, fingerprint detection or wrong IMEIs. Checkout both the threads here:

[Guide] [XT16XX] [Solve] Moto G4/Plus IMEI=0 issue.

[Guide] [XT16XX] [Solve] G4+ Baseband/Network/Volte issue, Lost 1 IMEI & fingerprint

For someone who has hardbricked his device , please refer to the following thread to get the raw bootloader and partition table and then flash the ROM as mentioned above.

[GUIDE] Moto G4 Plus HardBrick SOLVED - ULTIMATE UNBRICKING GUIDE

Credits:

TeamReviver

Motorola Mobility LLC

Android File Host

XDA-Developers