This paper investigates exact nonlinear dynamics and cooperative control for spacecraft formation flying with Earth oblateness (J2 perturbation) and atmospheric drag effects. The nonlinear dynamics for chief and deputy motions are derived by using Gauss' variational equation and the Euler-Lagrangian formulation, respectively. The proposed cooperative control employs adaptive time-varying Laplacian gains. The tracking and diffusive coupling gains are adapted by the synchronization/ tracking errors and distance-based connectivity, thereby defining a time-varying network topology. Moreover, the proposed method relaxes the network structure requirement and permits an unbalanced graph. Nonlinear stability is proven by contraction analysis and incremental input-to-state stability. Numerical examples show the effectiveness of the proposed method.