title: code pulls wrong versionName from manifest
body: <p>OK, I read several threads on getting the versionName from the manifest, as for use in an About dialog. Two techniques are noted. I did it both ways, and both come up with version 1.0, which is NOT what I have in the manifest. I can't find any posts noting the same problem. I'm working in Android Studio.</p>
  
  <p>Lines from the manifest:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.wabner.awesome_app"
      android:versionCode="23"
      android:versionName="0.70b"&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  </code></pre>
  
  <p>Lines from the About DialogFragment:</p>
  
  <pre><code>Context c = getActivity().getApplicationContext();
  String versionName = "";
  
  try {
      versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName;
  } catch (PackageManager.NameNotFoundException e) {
      e.printStackTrace();
  }
  
  TextView tv1 = (TextView) view.findViewById(R.id.version_number);
  tv1.setText(versionName);
  </code></pre>
  
  <p>Or, the simpler way:</p>
  
  <pre><code>TextView tv1 = (TextView) view.findViewById(R.id.version_number);
  tv1.setText(BuildConfig.VERSION_NAME);
  </code></pre>
  
  <p>I'm probably missing something obvious, but, I'm new at Android. And tired. To bed...</p>
  
  <p>Minutes later... is it possible the version number can only be accessed if the app is packed for distribution?</p>