Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid source release 1.7 error when compiling with gradle

I need 1.7 for a library which uses diamond operators.

I followed these sO answers...but no joy.

From gradle build

    compileSdkVersion 19 buildToolsVersion '19.0.3'  compileOptions {     sourceCompatibility JavaVersion.VERSION_1_7     targetCompatibility JavaVersion.VERSION_1_7 }  defaultConfig {     minSdkVersion 10     targetSdkVersion 19     versionCode 22     versionName "1.3.1" } 

Error: Execution failed for task ':MyApp:compileDefaultFlavorDebugJava'.

invalid source release: 1.7

Java home is set : $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home

like image 674
serenskye Avatar asked May 01 '14 12:05

serenskye


1 Answers

check your JVM versions. It should not be 1.6.

./gradlew --version javac -version 

on OSX check your $JAVA_HOME

echo $JAVA_HOME 

You can set your JAVA_HOME environment variable in ~/.bash_profile JDK:

/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/

like image 166
David Dehghan Avatar answered Sep 22 '22 23:09

David Dehghan