Non-equivalence between the Melnikov and the averaging methods for nonsmooth differential systems