  A recent LHCb measurement of the ratio $R_{K^*}$ of $B\to K^*\mu\bar\mu$ to
$B\to K^*e\bar e$ branching fractions has produced results in mild tension with
the standard model (SM). This adds to the known anomalies also induced by the
$b\to s\ell\bar\ell$ transitions, resulting in a confidence level now as high
as 4$\sigma$. We analyze whether the parameter space preferred by all the $b\to
s\ell\bar\ell$ anomalies is compatible with a heavy $Z'$ boson assumed to have
nonuniversal couplings to SM fermions dictated by the principle of minimal
flavor violation (MFV). We deal with the MFV couplings of the $Z'$ to leptons
in the context of the type-I seesaw scenario for generating neutrino masses.
The flavor-violating $Z'$ interactions are subject to stringent constraints
from other processes, especially $B$-$\bar B$ mixing, charged lepton decays
$\ell_i\to\ell_j\ell_k\bar\ell_l$ occurring at tree level, and the loop induced
$\mu\to e\gamma$. We perform scans for parameter regions allowed by various
data and predict the ranges for a number of observables. Some of the
predictions, such as the branching fractions of lepton-flavor violating
$\tau\to3\mu$, $B\to K e\mu$, $K_L\to e\mu$, and $Z\to\ell\ell'$, are not far
below their experimental bounds and therefore could be probed by searches in
the near future. The viable parameter space depends strongly on the neutrino
mass hierarchy, with a preference for the inverted one.
