Sometimes if you don't know what is wrong with gradle, you can use the command:
./gradlew clean build
to view in detail