title: Could not find method android.app.Activity.checkSelfPermission
body: <p>I am trying to implement runtime permission asking from the user using my app for the first time. Here is the code: </p>
  
  <pre><code>if (Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.M) {
          if ((ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) &amp;&amp;
                  (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)) {
              new masterdb(getApplicationContext());
              new checkRegistration().execute();
          } else {
  
          }
      } else {
          //initialize database
      }
  </code></pre>
  
  <p>But my app crashes with application not responding. The logcat shows something like this : </p>
  
  <blockquote>
    <p>Could not find method android.app.Activity.checkSelfPermission, referenced from method myPackageName.Lib.hasPermission
    09-16 11:46:54.969 3763-3763/myPackageName W/dalvikvm: VFY: unable to resolve virtual method 170: Landroid/app/Activity;.checkSelfPermission (Ljava/lang/String;)I</p>
  </blockquote>
  
  <p>The thing here is , this code shouldn't even run (checking for permission) in android Kitkat. But still I get this log. and when I move my code out of the if block of sdk version check it runs fine.</p>