'android-24' requires JDK 1.8 or later to compile
<p>I use Android Studio and recently got the error:</p>

<blockquote>
  <p>Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
  compileSdkVersion 'android-24' requires JDK 1.8 or later to compile.</p>
</blockquote>

<p>But I have JDK 1.8 installed already:</p>

<blockquote>
  <p>:\Users..>java -version<br>
  java version "1.8.0_91" Java(TM) SE Runtime<br>
  Environment (build 1.8.0_91-b15) Java HotSpot(TM) 64-Bit Server VM<br>
  (build 25.91-b15, mixed mode)</p>
</blockquote>

<p>How to fix it? Thanks</p>