  The existence and the regularity results obtained in [37] for the variational
model introduced in [36] to study the optimal shape of crystalline materials in
the setting of stress-driven rearrangement instabilities (SDRI) are extended
from two dimensions to any dimensions $n\geq2$. The energy is the sum of the
elastic and the surface energy contributions, which cannot be decoupled, and
depend on configurational pairs consisting of a set and a function that model
the region occupied by the crystal and the bulk displacement field,
respectively. By following the physical literature, the ``driving stress'' due
to the mismatch between the ideal free-standing equilibrium lattice of the
crystal with respect to adjacent materials is included in the model by
considering a discontinuous mismatch strain in the elastic energy. Since
two-dimensional methods and the methods used in the previous literature where
Dirichlet boundary conditions instead of the mismatch strain and only the
wetting regime were considered, cannot be employed in this setting, we proceed
differently, by including in the analysis the dewetting regime and carefully
analyzing the fine properties of energy-equibounded sequences. This analysis
allows to establish both a compactness property in the family of admissible
configurations and the lower-semicontinuity of the energy with respect to the
topology induced by the $L^1$-convergence of sets and a.e.\ convergence of
displacement fields, so that the direct method can be applied. We also prove
that our arguments work as well in the setting with Dirichlet boundary
conditions.
