In my case, IntelliJ created 2 module configurations: the old and the new. It was using the old one. I tried to delete it from Project Structure, but IntelliJ refused to delete it.
So I closed IntelliJ and deleted the module from the console with the following commands:
Remove IntelliJ IDEA project files: rm -rf .idea find . -name "*.iml" -type f -delete
Clean Gradle build: ./gradlew clean
Remove Gradle caches for your specific project: rm -rf ~/.gradle/caches/modules-2/files-2.1/YOUR_FOLDER_HERE
For example, if you are in a project com.enterprise.something.else, you should do: rm -rf ~/.gradle/caches/modules-2/files-2.1/com.enterprise
Open IntelliJ and use "File -> Open Project" to import the project from scratch, allowing IntelliJ to reconfigure everything.