[Treble-Enabled Device Development A/AB ROMS] MotoX4:
I received more than a few PM's about this so I'll just leave this here rather than keep answering PM's. I'm also going to post this in the Moto X4 forum (giving the developer credit where credit is due of course and linking back here to this thread)

/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/

How to install Havoc-OS on Moto X4

!! Please read before proceeding !!

Download the latest Official TWRP https://dl.twrp.me/payton/. - You want the .img file.

Restart your phone to your bootloader. - You do this by pressing and holding both your phone's power button and the lower volume key at the same time.

Once at your phone's bootloader, from your Windows Command Prompt (as administrator) or from your Linux Terminal (as root) run the following command to load TWRP:

fastboot boot '/your_path_here/twrp-X.X.X-X-payton.img'

Note: Be sure to use your path on where you have the file on your computer. Be sure to replace and use the correct file name for your file (Do not just copy and paste the example posted here).

!! You will be wiping everything because regardless if you are coming from stock or a different ROM as this ROM works best with a full wipe !!

Note: If upgrading this ROM a full wipe is not necessary. See upgrade instructions below.​

Regardless of what ROM you are coming from (stock or not), format your DATA.

Reboot your device to bootloader and reuse the previous fastboot command to load TWRP listed above.

Regardless of what ROM you are coming from (stock or not), wipe your device (all partitions).

Reboot your device to bootloader and reuse the previous fastboot command to load TWRP listed above.

If coming from stock:

Download "Copy Partitions Zip" - courtesy of [MENTION=3069475]filipepferraz[/MENTION] https://drive.google.com/file/d/1oiry9UfP2tf-5A6nQBF7pn2t2eSGKt0F/view

Upload "Copy Partitions Zip" to your phone using the "ADB Push" command to /sdcard/ (run as admin if on windows or as root if on Linux).

adb push copy-partitions-payton.zip /sdcard/

Now INSTALL "Copy Partitions Zip"

Reboot to your bootloader. - Stay at the bootloader screen (do not load TWRP)

Download the firmware for your phone

XT1900-1 Android 8.0

firmware_27.251.12_payton_retail_xt1900-1.zip

Only tested on

XT1900-1

XT1900-2

XT1900-5 (https://xdaforums.com/showpost.php?p=76934354&postcount=173)

XT1900-7 (https://xdaforums.com/showpost.php?p=76779696&postcount=14)

feel free to test on other Moto X4 models running 8.0.

XT1900-6 Android 8.0 - courtesy [MENTION=3069475]filipepferraz[/MENTION]

https://www.androidfilehost.com/?fid=674106145207492371

XT1900-1 Android 8.1 - courtesy [MENTION=4487886]ptn107[/MENTION]

https://www.androidfilehost.com/?fid=890278863836292604

tested on XT1900-7 as well (https://xdaforums.com/showpost.php?p=76816113&postcount=92)

Unzip on your computer.

User flash_all.bat if on windows as administrator OR ./flash_all.sh if on Linux as root.

Reboot your phone to bootloader

Continue:

Reboot your device to bootloader and reuse the previous fastboot command to load TWRP listed above.

Download and locate the latest Amr64 A/B ROM located here: https://sourceforge.net/projects/havoc-os/files/arm64ab/ - NOTE: You want the ROM that comes without Gapps. You can install Gapps after (see instructions below).

Extract the zip (XZ file) onto your computer. -- I suggest the free and open source program 7zip https://www.7-zip.org/

You will upload these files to your phone using the "ADB PUSH" command to your /sdcard/ directory (as admin in windows or root in Linux). For example:

adb push Havoc-OS-v2.0-20181016-GSI-ARM64-AB-Official.img /sdcard/

In TWRP select Install *

Select Install image

Locate your .IMG file and install.

* TWRP troubleshooting:

A small group of individuals has reported that TWRP will not correctly install this ROM directly. If you're one of those few people a manual install may work for you.

First wipe your phone again

Reboot back to bootloader. - Stay at bootloader

As an administrator on windows or as root on Linux run this command

fastboot -u flash system Havoc-OS-v2.0-20181016-GSI-ARM64-AB-Official.img

Note: Be sure to use your path on where you have the file on your computer. Be sure to replace and use the correct file name for your file (Do not just copy and paste the example posted here).

Credit to [MENTION=3352385]*.jpg[/MENTION] for this solution. :)

!! IMPORTANT !! Do NOT install TWRP or Magisk after installing this ROM as it is already included with the ROM.

NOTE: Do NOT yet install Gapps. See instructions below.​

After a successful install, REBOOT your phone.

Congratulations, you're done! :cool:​

If adding Gapps: -- Read me

Your phone will work perfectly fine without Gapps. But if you do want to install Apps and use Google products and services; I recommend the minimal Gapps install known as Pico. You clean learn about the many different Gapps flavors by visiting the Open Gapps Wiki found here https://github.com/opengapps/opengapps/wiki/Package-Comparison

Let your phone boot the ROM for the 1st time. - !! IMPORTANT !! You want to fully boot your phone and let the ROM load for the 1st time before installing Gapps.

After your phone as successfully booted up and loaded the ROM, reboot back into recovery

Download the latest Gapps - https://opengapps.org

Upload the zip to your phone

Install Gapps

Wipe cache/dalvik

Additionally, if you're one of those paranoid people who want to keep your distance away from Google (to each their own, but I love me some Google ) you do have the following alternatives.

https://apkpure.com/

https://en.uptodown.com/android

https://f-droid.org

Just remember that these are unofficial sources and you take the risk that can potentially come with them.

UPGRADING - How to upgrade this ROM.

Also known as a dirty upgrade, you do not need to wipe everything and start over. However, if this dirty upgrade fails a fresh install is recommended.

Download the latest ROM

Reboot into recovery

Install your new .img file

Wipe cache/dalvik

Reboot

If all has gone well you're done! If not, a full wipe and install are recommended.

* Project Fi

The Official Project Fi app when installed will inform you that you cannot activate using this ROM. However, I find no limit in functionality (calls, text, data all work) and the app still lets you manage your account. Basically, it is my opinion that you can safely ignore this warning (which vanished after my 2nd attempt activating and after rebooting the phone). For that reason, since everything works, I believe it's OK to ignore the original warning. - If you do not have Google Project Fi this does not apply to you and you too can ignore this.