Let $u \in C^{\infty}(\mathbb{R}^n)$ be such that $\nabla u \in C^{\infty}_c(\mathbb{R}^3; \mathbb{R}^3)$ and $\Delta u=0$. I wish to prove or disprove that $u = c$ for some $c \in \mathbb{R}^n$; note the statement would be true with $c=0$ (by Liouville classical theorem) if $u$ itself is compactly supported.
I had the idea of exploiting a representation formula like:
$$ u(x) = \frac{1}{n \omega_n} \int_{\mathbb{R}^3} \nabla u(y) \cdot \frac{x-y}{|x-y|^n} dy $$
together with an integration by parts in order to get the Laplacian. Unfortunately, the latter is only valid if $u \in W^{1,1}(\mathbb{R}^n)$ and here we don't have the hypothesis $u \in L^1(\mathbb{R}^n)$. I am stuck here, but at same time I cannot produce a counterexample.
Note that the gradient has compact support, thus $u$ is constant outside a compact set. Hence, there exists a constant $c$ such that $v:=u-c$ has compact support. But $v$ is harmonic and thus vanishes. This implies that $u$ is constant.