title: Android SDK 28 - versionCode in PackageInfo has been deprecated
body: <p>I just upgraded my app's <code>compileSdkVersion</code> to <code>28</code> (Pie).</p>
  
  <p>I'm getting a compilation warning:</p>
  
  <blockquote>
    <p>warning: [deprecation] versionCode in PackageInfo has been deprecated</p>
  </blockquote>
  
  <p>The warning is coming from this code:</p>
  
  <pre><code>final PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
  int versionCode = info.versionCode;
  </code></pre>
  
  <p>I looked at the <a href="https://developer.android.com/reference/kotlin/android/content/pm/PackageInfo#versioncode" rel="noreferrer">documentation</a>, but it doesn't say anything about how to resolve this issue or what should be used instead of the deprecated field.</p>