JDK 11 Build Support

This was a good opportunity for me to learn and test android using above gradle template.

I locally compiled jdk-11 branch with Java 8 and created a hello world (blue cube) example apk and I was able to run it on my phone with android 4.0.3 successfully.

I used following tutorial to install android sdk on linux (No need to install Android Studio at all) :

Then I set sdk path in

also changed this line :

to :

classpath 'com.android.tools.build:gradle:3.3.2'

and commented out this line:

    // We do not need this, as each version of the Android Gradle Plugin now has a default version of the build tools.
    //buildToolsVersion "24.0.2"

Edit:
btw, we can compile it even with java 11 (with no need to have java 8 installed), we just need to set “–release 8” flag to java compiler in gradle build. (I have not tested this myself yet)

compileJava {
  options.compilerArgs.addAll(['--release', '8')]
}

see this for more info:
https://github.com/gradle/gradle/issues/2510

Edit 2:
Forgot this one, I also add

mavenLocal()
mavenCentral()
google()

in

and

3 Likes