Metal-organic frameworks are a new type of catalyst precursor with high specific surface area and controllable composition, which can be modified by post-treatment and are suitable for use as cathode catalysts for Zn-air batteries (ZABs). Here, a self-doped nitrogen nanocatalyst (N-PC@CF) with a double-layered porous structure is rationally designed for flexible solid-state ZABs. The outer porous carbon shell of the N-PC@CF is highly hydrophilic and O2 permeable, while the layered porous structure exposes sufficient active sites to shorten the mass transfer distance, which would promote electrocatalytic performance and increase flexibility efficiently. The obtained N-PC@CF has an onset potential of 0.926 V and a half-wave potential of 0.843 V in the oxygen reduction reaction test, which is equivalent to commercial Pt/C. Most importantly, the maximum power density of the assembled ZAB is 134.7 mW cm−2 and it exhibits a specific capacity of 776.8 mA h g−1 at 10 mA cm−2, which is better than the 99.9 mW cm−2 of the Pt/C-based battery. An obvious improvement in the constant current discharge–charge cycle durability of the ZAB is found when compared with Pt/C. The specific capacities of ZAB with N-PC@CF as the air cathode at 5, 10 and 15 mA cm−2 are 842.7, 776.8 and 715.0 mAh g−1 (calculated by the mass of zinc consumed), respectively, corresponding to high energy densities of 1089.7, 977.3 and 842.2 Wh kg−1. A flexible solid-state battery is assembled with excellent flexibility and stability, even if the battery is folded into a large angle (160°). This work provides a new strategy for the design and synthesis of metal-free air cathodes.