First-principle-based prediction of mean-flow quantities of wall-bounded turbulent flows (channel, pipe and turbulent boundary layer (TBL)) is of great importance from both physics and engineering standpoints. Here we present a symmetry-based approach which yields analytical expressions for the mean-velocity profile (MVP) from a Lie-group analysis. After verifying the dilatation-group invariance of the Reynolds averaged Navier–Stokes (RANS) equation in the presence of a wall, we depart from previous Lie-group studies of wall turbulence by selecting a stress length function as a similarity variable. We argue that this stress length function characterizes the symmetry property of wall flows having a simple dilatation-invariant form. Three kinds of (local) invariant forms of the length function are postulated, a combination of which yields a multi-layer formula giving its distribution in the entire flow region normal to the wall and hence also the MVP, using the mean-momentum equation. In particular, based on this multi-layer formula, we obtain analytical expressions for the (universal) wall function and separate wake functions for pipe and channel, which are validated by data from direct numerical simulations (DNS). In conclusion, an analytical expression for the entire MVP of wall turbulence, beyond the log law or power law, is developed in this paper and the theory can be used to describe the mean turbulent kinetic-energy distribution, as well as a variety of boundary conditions such as pressure gradient, wall roughness, buoyancy, etc. where the dilatation-group invariance is valid in the wall-normal direction.