title: No virtual method getLongVersionCode()J when getting version code
body: <p>According google suggestion i am using <code>getLongVersionCode</code> to get version code like this:</p>
  
  <pre><code>private long getCurrentCode() {
      try {
          return context.getPackageManager()
                  .getPackageInfo(context.getPackageName(), 0).getLongVersionCode();
      } catch (Exception e) {
          e.printStackTrace();
      }
      return -1;
  }
  </code></pre>
  
  <p>but when i run my app, my app force closed and i got this error:</p>
  
  <pre><code>Process: com.xxxxx.debug, PID: 25754
      java.lang.NoSuchMethodError: No virtual method getLongVersionCode()J in class Landroid/content/pm/PackageInfo; or its super classes (declaration of 'android.content.pm.PackageInfo' appears in /system/framework/framework.jar)
          at com.xxxxx.common.ApplicationUpdateTask.getCurrentCode(ApplicationUpdateTask.java:329)
          at com.xxxxx.common.ApplicationUpdateTask.&lt;init&gt;(ApplicationUpdateTask.java:84)
  </code></pre>
  
  <p>So i decided to use:</p>
  
  <pre><code>String versionName = BuildConfig.VERSION_NAME;
  </code></pre>
  
  <p>but now this commend return <code>-1</code> !!!!!</p>
  
  <p>This is my gradle config:</p>
  
  <pre><code>compileSdkVersion 28
      buildToolsVersion '28.0.3'
      defaultConfig {
          minSdkVersion 15
          targetSdkVersion 28
          versionCode 66
          versionName '2.0.66'
          applicationId 'com.xxxxxx.yyyyy'
          multiDexEnabled true
      }
  </code></pre>