We present a set of new analytic solutions aimed at self-consistently describing the spatially-averaged time evolution of the gas, stellar, metal, and dust content in an individual starforming galaxy hosted within a dark halo of given mass and formation redshift. Then, as an application, we show that our solutions, when coupled to specific prescriptions for parameter setting (inspired by in-situ galaxy-black hole coevolution scenarios) and merger rates (based on numerical simulations), can be exploited to reproduce the main statistical relationships followed by early-type galaxies and by their high-redshift starforming progenitors. Our analytic solutions allow to easily disentangle the diverse role of the main physical processes regulating galaxy formation, to quickly explore the related parameter space, and to make transparent predictions on spatially-averaged quantities. As such, our analytic solutions may provide a basis for improving the (subgrid) physical recipes presently implemented in theoretical approaches and numerical simulations, and can offer a benchmark for interpreting and forecasting current and future broadband observations of high-redshift starforming galaxies.2 PANTONI ET AL. evolution of the gas, stellar, metal, and dust content in an individual starforming galaxy hosted within a dark halo of given mass and formation redshift. Our basic framework pictures a galaxy as an open, one-zone system comprising three interlinked mass components: a reservoir of warm gas subject to cooling and condensation toward the central regions; cold gas fed by infall and depleted by star formation and stellar feedback (type-II supernovae [SNe] and stellar winds); stellar mass, partially restituted to the cold phase by stars during their evolution. Remarkably, the corresponding analytic solutions for the metal enrichment history of the cold gas and stellar mass are self-consistently derived using as input the solutions for the evolution of the mass components; the metal equations includes effects of feedback, astration, instantaneous production during star formation, and delayed production by type-Ia SNe, possibly following a specified delay time distribution. Finally, the dust mass evolution takes into account the formation of grain cores associated to star formation, and of the grain mantles due to accretion onto pre-existing cores; astration of dust by star formation and stellar feedback, and spallation by SN shockwaves are also included.We then apply our analytic solutions to describe the formation of spheroids/early-type galaxies (ETGs) and the evolution of their starforming progenitors. To this purpose, we couple our solutions to two additional ingredients: (i) specific prescriptions for parameter setting, inspired by in-situ galaxy-black hole coevolution scenarios of ETG formation; (ii) estimates of the halo and stellar mass growth by mergers, computed on the basis of the merger rates from state-of-the-art numerical simulations. We then derive and confront with available data a bunch of fundamental spatially-...