Do you have enough room to install a recessed box behind the dryer (www.dryerbox.com)? That should allow you to push the dryer against the wall or very close to the wall. Inside the wall if you can't fit 4" rigid duct in that wall, they make ovalized duct that will fit within 2x4 intra-stud spaces. You can also find the transition parts to go from ovalized duct to standard 4" round duct when you reach a space that can take the full size duct.
With regard to side venting...
How much space do you have between the wall and the side of the dryer? If you have several inches you could use a periscope to get to a spot where you don't interfere with a stud. I'm not a big fan of periscopes, but for a short little jog where you then directly vent to the outside it should be just fine. Whatever you do have it constructed so you can clean out any lint build-up one or two times a year. Since a duct brush won't snake down a periscope that mean being able to disconnect it from the dryer and the wall so it can be taken apart for cleaning.
Q