[Xperia Z2 Q&A, Help & Troubleshooting] 5ageman:
Rooting and romming Sony devices is a little harder than most android devices, some things work a little different. The scattered info doesn't make this any easier either. I had to find this out the hard way, softbricked my Xperia in the process, but I finally did it. I see that there still are people that wish to root stock 5.1.1 and that there are no unified proper instructions to do this so here is my process and guide. Good luck.

There are many ways to do this, but it includes flashing your Xperia to earlier firmware then rooting and installing the recovery and then flashing back the newest firmware, so I made this little guide to make things easier for Sony newcomers. This process should be compatible with Z1, Z2 and Z3(c) - but ofcourse its made for Z2, for Z1 and Z3 download recovery files for your model respectively.

You won't loose any of your data on your stock ROM if you do this correctly.

You'll need a Windows PC, 7, 8.1, 10. (Mac and Linux are also supported)

1. Root your Z with Kingroot.apk v4.6 and v4.8 work flawlessly. Just download and install as normal apk and hit the big blue button. You have to have internet connection for this to work. It will root your Z automatically after cca. 2m.

Kingroot app is basically a super su app from a different developer. Congrats, you now have root.

2. To install a recovery do not use any flashing apps by TWRP or similar, it wont work. We will use XDZR.

XZDR is Xperia Z Dual Recovery, its basically Philz recovery and TWRP recovery flashed together. You enter Philz holding vol up and TWRP holding vol down when powering up your xperia. * Search for NUT's dual recovery for more info.

Download the recovery from here:

http://nut.xperia-files.com/path/XZDualRecovery

(Download the correct .zip for your Xperia model).

3. Download the. zip to your PC.

4. Connect your phone via USB after you have enabled USB debugging on your xperia. If you have correct Sony drivers installed your PC will recognize your device and a dialog will pop up on your phone (about allowing USB debugging from this PC). Allow the access.

5. Unpack the zip you downloaded to a random folder on your PC. Here run the install.bat if you're on a Win PC. Bat will run and here you just choose the first option, type 1 and follow the on screen instructions, keep an eye on your phone, it will pop up a couple of yes - no dialogs. Allow the access and ADB access and wait, it will be fast.

When you reboot you will see a green LED light up while SONY splash is shown, this is when you hold up or down for one of the two recoveries.

Down is for TWRP and up is for Philz.

6. Download superSU from here:

https://download.chainfire.eu/696/SuperSU/

Boot to system again and now you can unroot your phone trough Kingroot app (general settings) and then reboot to recovery again and flash the file from this link, you will get the super su app and super su binaries and this way you're fully rooted and will have dual recovery for your full flashing pleasure.

* Remember that you first need to unroot and uninstall Kingroot app and then flash Super su, otherwise you risk a bootloop or just not functional root access.

* Do not flash newer TWRP or any recovery or youll loose your recovery.

* I am not responsible if something goes wrong with your device.

And thats it, you have your data intact, stock 5.1.1 ROM, fully functional root access with super su and two recoveries, intact BL and DRM keys and you can flash almost anything that supports LB (locked bootloader).