  We study anomalies of fermions with spacetime dependent mass. Using
Fujikawa's method, it is found that the anomalies associated with the
$U(N)_+\times U(N)_-$ chiral symmetry and $U(N)$ flavor symmetry for even and
odd dimensions, respectively, can be written in terms of superconnections. In
particular, the anomaly for a vector-like $U(1)$ symmetry is given by the Chern
character of the superconnection in both even and odd dimensional cases. It is
also argued that the non-Abelian anomaly for a system in D-dimensional
spacetime is characterized by a (D+2)-form part of the Chern character of the
superconnection which generalizes the usual anomaly polynomial for the massless
case. These results enable us to analyze anomalies in the systems with
interfaces and spacetime boundaries in a unified way. Applications to index
theorems, including Atiyah-Patodi-Singer index theorem and Callias-type index
theorem, are also discussed. In addition, we give a natural string theory
interpretation of these results.
