Here, we present a protocol for the synthesis of CH3NH3I and CH3NH3Br precursors and the subsequent formation of pinhole-free, continuous CH3NH3PbI3-xBrx thin films for the application in high efficiency solar cells and other optoelectronic devices.