title: Proper way to test Android app on lower API level (Android Studio)
body: <p>I am new to Android (but not new to programming) and developing my first serious Android app. Everything went fine until I was developing for Marshmallow (API level 23). I decided to test my app on another device with API level 16 and now compiler throws MANY warnings and errors like this:</p>
  
  <pre><code>06-26 12:14:13.060 19473-19473/com.blueit.unico E/Trace: error opening trace file: No such file or directory (2)
  06-26 12:14:13.100 19473-19473/com.blueit.unico W/dalvikvm: VFY: unable to resolve virtual method 482: Landroid/content/Context;.getSystemService (Ljava/lang/Class;)Ljava/lang/Object;
  06-26 12:14:13.100 19473-19473/com.blueit.unico E/dalvikvm: Could not find class 'android.os.UserHandle', referenced from method com.blueit.unico.UnicoApplication.access$super
  06-26 12:14:13.100 19473-19473/com.blueit.unico W/dalvikvm: VFY: unable to resolve check-cast 242 (Landroid/os/UserHandle;) in Lcom/blueit/unico/UnicoApplication;
  06-26 12:14:13.100 19473-19473/com.blueit.unico W/dalvikvm: VFY: unable to resolve virtual method 536: Landroid/content/ContextWrapper;.getCodeCacheDir ()Ljava/io/File;
  </code></pre>
  
  <p>Seems like some kind of version conflict. Application itself is deployed and <em>seems</em> to be working fine (but it is very basic now). I have done some research on the Internet and people mention that I need to change targetSDKVersion in build.gradle file. But do I really need to edit this file manually? Shouldn't Android Studio recognize that device has older API and compile for that version? I did some little test apps before and they run or different devices with no problems without changing anything. <br><br>In case people on internet are right and I really need to edit build.gradle file by hand, it looks like this:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.3"
  
      defaultConfig {
          applicationId "com.blueit.unico"
          minSdkVersion 11
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.4.0'
      compile 'com.android.support:design:23.4.0'
  }
  </code></pre>
  
  <p>Then new questions arise. What exactly do I have to change? It is clear for me that targetSdkVersion and compileSdkVersion should probably be changed, but what about these lines?<br></p>
  
  <pre><code>buildToolsVersion "23.0.3"
  
  compile 'com.android.support:appcompat-v7:23.4.0'
  compile 'com.android.support:design:23.4.0'
  </code></pre>
  
  <p>Should they be changed too? And if yes, to what versions?<br>
  Thank you in advance.</p>
  
  <p><strong>SOLVED:</strong> After noticing that all errors and warnings come from <code>dalvikvm</code> and <a href="https://github.com/square/okhttp/wiki/FAQs" rel="nofollow noreferrer" title="some">doing</a> <a href="https://stackoverflow.com/questions/23067886/vfy-unable-to-resolve-lots-of-stuff">some</a> research for several hours I came to conclusion that this is some kind of dalvik virtual machine verification and they are not "real" errors and warnings - just information that my app uses newer features (which it certainly does). Feels weird to ignore tens of errors and warnings though.</p>