Build compatible bytecode with newer JDKs

Fix #2898, close #2899
This commit is contained in:
topjohnwu 2020-06-21 02:43:32 -07:00
parent 1ededc637e
commit 099e703834
2 changed files with 12 additions and 1 deletions

View File

@ -40,6 +40,16 @@ subprojects {
maven { url "https://jitpack.io" }
maven { url "http://oss.sonatype.org/content/repositories/snapshots" }
}
if (getPlugins().hasPlugin('java')) {
tasks.withType(JavaCompile) {
// If building with JDK 9+, we need additional flags to generate compatible bytecode
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
options.compilerArgs += ['--release', '8']
}
}
}
afterEvaluate { module ->
if (getPlugins().hasPlugin('com.android.library') ||
getPlugins().hasPlugin('com.android.application')) {

View File

@ -1,5 +1,6 @@
#Sat Jun 20 05:36:13 PDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip