You can do it like this
https://marschall.github.io/2017/04/17/disabling-gradle-cache.html
To quote from Disabling the Gradle Build Cache
The Gradle build cache may be a great thing when you’re regularly building >large projects with Gradle. However when only occasionally building open source >projects it can quickly become large.
To disable the Gradle build cache add the following line to
~/.gradle/gradle.properties
org.gradle.caching=false
You can clean the existing cache with
rm -rf $HOME/.gradle/caches/ rm -rf $HOME/.gradle/wrapper/