If you get this error after installing Brew in Ubuntu Linux : Brew Install Gradle fix (Linuxbrew install steps don’t add brew to PATH) , check my solution
Type this in the Terminal
#eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
how to install Gradle on ubutu : here