Failed to build android ndk sample with gradle 2.5

Hi, I got this error when building the sample ndk project with gradle 2.5. Any idea? thank you.
Error:Execution failed for task ‘:app:dexArm7Debug’. org.gradle.process.internal.ExecException: Process ‘command ‘/usr/java/jdk1.8.0_40/bin/java’’ finished with non-zero exit value 1

It works. Add this in build.gradle

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7