I have an Android project, broken into a pure Java library and an Android application. I am using Gradle Retrolambda , so I can write Java 8 code.
Android Studio 1.3 correctly recognizes android.compileOptions.sourceCompatibility in the Android module that I installed in JavaVersion.VERSION_1_8 .
Now I would like Android Studio to realize that the Java module is also Java 8. I tried (in the root of the Gradle script, after apply plugin 'java' :
sourceCompatibility = 1.8 But does not work. Gradle compiles correctly, but Android Studio shows a warning ("Destination is not used") and assumes Java 6.
sourceCompatibility 1.8 does not compile.
How can I get Android Studio to recognize this without resorting to the โInstall Source Versionโ quick installation? Or is it not implemented at the moment?
EDIT
To clarify, the entire project is compiled with ./gradlew assembleDebug . The problem is with the highlighting of the source code for Android Studio.
My Java build.gradle module is as follows:
buildscript { repositories { mavenCentral() } dependencies { classpath 'me.tatarka:gradle-retrolambda:3.2.0' } } repositories { jcenter() mavenCentral() } apply plugin: 'java' apply plugin: 'me.tatarka.retrolambda' sourceCompatibility = JavaVersion.VERSION_1_8 dependencies { compile 'io.reactivex:rxjava:1.0.12' compile 'io.reactivex:rxjava-string:1.0.0' compile 'joda-time:joda-time:2.8.1' testCompile 'junit:junit:4.12' } retrolambda { jdk System.getenv("JAVA_HOME") defaultMethods true incremental false }
And here is what Android Studio offers me: 
source share