We develop a gravitational theory where the measure of integration in the action principle is not necessarily √-G but it is determined dynamically through additional degrees of freedom. This theory is based on the demand that such measure respects the principle of "non-gravitating vacuum energy" which states that the Lagrangian density L can be changed to L + const. without affecting the dynamics. Formulating the theory in the first-order formalism we get as a consequence of the variational principle a constraint that enforces the vanishing of the cosmological constant. The most realistic model that implements these ideas is realized in a six or higher dimensional space-time. The compactification of extra dimensions into a sphere gives the possibility of generating scalar masses and potentials, gauge fields and fermionic masses. It turns out that the remaining four-dimensional space-time must have effective zero cosmological constant.