title: Unable to resolve checkSelfPermission() or requestPermissions()
body: <p>This is probably a very dumb question.</p>
  
  <p>I have an app written using Eclipse years ago, for Android OS 8 (2.3.x). I am trying to bring it into the modern world (still built with 8, but targetting 28), and have moved it to Android Studio. I haven't touched Android code for some years, know very little indeed about Android Studio, and less still about Gradle.</p>
  
  <p>I am currently trying to deal with the different permissions environment, ie checking on start up and requesting if necessary. I have the following code in the main activity (extended from Activity) - I know this is simple and could do with other logic, I am just trying to get it going in principle at the moment:</p>
  
  <pre><code>...
  import android.content.pm.PackageManager;
  import android.support.v4.app.ActivityCompat;
  import android.support.v4.content.ContextCompat;
  ...
      onCreate(...) {
      ...
      if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
          ActivityCompat.requestPermissions(
                  this,
                  new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
                  ID_ACCESS_FINE_LOCATION);
      ...
  </code></pre>
  
  <p>android-support-v4.jar is under /libs in the project.</p>
  
  <p>The build cannot resolve checkSelfPermission() or requestPermissions(), despite the imports.</p>
  
  <p>I have found other questions on this, and one (self-)answer was <em>"AS imported the supportlib as a jar and this jar was from like 2014. I just replaced the jarimport with the real dependency and now it is working."</em></p>
  
  <p>This sounds a bit like me, but unfortunately with my limited knowledge of the build environment, I don't really understand the answer, and I am worried about screwing something big time by mistake. I'd be very grateful if someone could explain in words of one syllable what I actually need to do to resolve this, or at least point me to somewhere it is explained ....</p>
  
  <p>Thanks.</p>
  
  <p>POSTSCRIPT</p>
  
  <p>build.gradle as requested in comment (apart from my changing the target SDK, it was created automatically on import from the Eclipse tree):</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 8
      buildToolsVersion "29.0.2"
  
      defaultConfig {
          applicationId "uk.co.nightshadearts.gpscompass"
          minSdkVersion 8
          targetSdkVersion 28
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
  }
  
  dependencies {
      compile project(':googleplayservices_lib')
      compile files('libs/android-support-v4.jar')
  }
  </code></pre>