When building a project in android studio and the project is ionic cordova android project, sometimes gradle throws an error: e.g. Error:Cause:com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDepedencyCacheDir(Ljava/io/F;)
Solution: Open gradle, the one on the project level and it will ask you to fixe Gradle Wraper problem and hit fix now, problem solved.