title: How does sourceCompatibility and targetCompatibility impact number of supported devices?
body: <h1>What I know</h1>
  
  <p>I am quite familiar with the common the settings found in <code>build.gradle</code></p>
  
  <p><code>minSdkVersion 21</code> - means that the Android device needs to at least have Android API level 21 or greater to install my app</p>
  
  <p>(this should be as low as possible, so to reach the maximum number of users while preserving all mission critical app functionality) </p>
  
  <p><code>targetSdkVersion 26</code> - means that my app was "designed" for this version of the Android API, so that the device knows whether or not to run in compatibility mode, etc.</p>
  
  <p>(this should be as high as possible, and for developers to update along with any deprecated API calls)</p>
  
  <h1>What I am confused about</h1>
  
  <p>But what about <code>sourceCompatibility</code> and <code>targetCompatibility</code> that specify the JDK version to use? I seem to be getting conflicting messages.</p>
  
  <p>For example, when I look into my project structure settings in Android studio, I seem to be getting recommendations of using the default JDK that comes with Android Studio - <code>version 1.8</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/dQTMn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dQTMn.png" alt="enter image description here"></a></p>
  
  <p>However, when I read other online sources such as the following:</p>
  
  <ul>
  <li><p><a href="https://www.christopherprice.net/which-jdk-do-i-use-with-android-studio-3686.html" rel="noreferrer">https://www.christopherprice.net/which-jdk-do-i-use-with-android-studio-3686.html</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/17869069/which-jdk-version-language-level-is-required-for-android-studio">Which JDK version (Language Level) is required for Android Studio?</a></p></li>
  </ul>
  
  <p>I seem to get the message that Android mostly runs on <code>version 1.7</code> and only supports a small subset of <code>version 1.8</code> - suggesting that <code>version 1.7</code> is the logical choice instead.</p>
  
  <h1>Summary</h1>
  
  <p><strong>Question 1)</strong> </p>
  
  <p>Which version should I use for maximum compatibility with new and old Android devices? <code>version 1.7</code> or <code>version 1.8</code>? (Does this even matter? Refer to question #2)</p>
  
  <p><strong>Question 2)</strong></p>
  
  <p>Is <code>sourceCompatibility</code> and <code>targetCompatibility</code> (and JDK version) something that is only used during compilation from <code>.java</code> files to <code>.class</code> files? So after the java byte code is generated, whatever version (<code>version 1.7</code> vs <code>version 1.8</code>) won't matter anymore - since the byte code will be the same &amp; interoperable regardless. </p>
  
  <p>Or is this something that will persist all the way up to the end user (e.g. if their Android phone's JVM doesn't know how to read <code>version 1.8</code> byte code, it will just blow up)</p>
  
  <p><strong>Question 3)</strong></p>
  
  <p>What happens if I set <code>minSdkVersion</code> to something very low (e.g. <code>10</code>) while setting <code>sourceCompatibility</code> and <code>targetCompatibility</code> to something very high (e.g. <code>version 1.8</code>)?</p>
  
  <p>Can I blindly rely on Android Studio to catch all possible incompatibilities? As in, if it successfully builds an APK, I am guaranteed it will work?</p>
  
  <p>Or will it still build and let users with <code>API &gt;= 10</code> install it, but will just blow up on runtime if the users device JVM can't run <code>version 1.8</code>?</p>