6

I get a warning message at Build time in my gradle console:

warning: [options] bootstrap class path not set in conjunction with -source 1.7 1 warning

How can I fix this?

Any help is appreciated!

Austin Joseph
  • 75
  • 3
  • 7
  • Possible duplicate of [warning: \[options\] bootstrap class path not set in conjunction with -source 1.5](http://stackoverflow.com/questions/7816423/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-5) – Dave Jarvis Apr 26 '17 at 18:00

3 Answers3

3

Simply put the following code inside the buildscript tag of the project level build.gradle:

tasks.withType(JavaCompile) {
    targetCompatibility = '1.7'
    sourceCompatibility = '1.7'
    options.setBootClasspath("PATH_TO_JAVA_7_JRE/lib/rt.jar")
}

Just make sure to replace PATH_TO_JAVA_7_JRE with the path to yours.

I've struggled with this issue myself a couple of weeks now and finally come up with a solution, which hopefully works for others as well. Hope it helps!

Daniel Kvist
  • 3,032
  • 5
  • 26
  • 51
0

If using Android Studio and no other requirement is set on the version of the JDK maybe you can choose to use the embedded JDK:

  • File -> Project Structure -> SDK Location -> Use embedded JDK (recommended)
Ely
  • 10,860
  • 4
  • 43
  • 64
0

In build.gradle, try to set:

sourceCompatibility = 1.7
targetCompatibility = 1.7
Folio
  • 1