The all-inorganic perovskite cesium lead bromine (CsPbBr3) has attracted much attention in the field of X-ray detectors because of its high x-ray absorption coefficient, high carrier collection efficiency, and easy solution preparation. The low-cost anti-solvent method is the main method to prepare CsPbBr3; during this process, solvent volatilization will bring a large number of holes to the film, leading to the increase of defects. Based on the heteroatomic doping strategy, we propose that Pb2+ should be partially replaced by Sr2+ to prepare leadless all-inorganic perovskite. The introduction of Sr2+ promoted the ordered growth of CsPbBr3 in the vertical direction, increased the density and uniformity of the thick film, and achieved the goal of CsPbBr3 thick film repairing. In addition, the prepared CsPbBr3 and CsPbBr3:Sr X-ray detectors were self-powered without external bias, maintaining a stable response during on and off states at different X-ray dose rates. Furthermore, the detector base on 160 µm CsPbBr3:Sr had a sensitivity of 517.02 µC Gyair−1 cm−3 at zero bias under the dose rate of 0.955 µGy ms−1 and it obtained a fast response speed of 0.053–0.148 s. Our work provides a new opportunity to produce cost-effective and highly efficient self-powered perovskite X-ray detectors in a sustainable way.