For security purposes, hierarchyviewer only works on debug / developer devices.
The Nexus 4 does qualify, but you WILL need to unlock the phone first before you can do so. Since you're concerned with warranty, then you shouldn't do that.
The closest thing you can do is to apply Romain Guy's ViewServer romainguy/ViewServer on your application, then you can use HierarchyViewer on your app.
(Note: Yes, you can relock the bootloader and unroot from guides in XDA, but it is up to you if you want to do that and pretend your warranty still holds.)