BuildConfig.VERSION_CODE;
and
getPackageManager().getPackageInfo(...).
will give us:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" ... android:versionCode="1" android:versionName="...">
versionCode, 1 in this example.
The API level used to compile .apk could not find a way to consult it at run time, but if you use gradle , you can check it out:
android { compileSdkVersion 22 buildToolsVersion "22.0.1" ... }
if you use .iml configured using the graphical interfaces of the IntelliJ project:
<component name="NewModuleRootManager" inherit-compiler-output="true"> ... <orderEntry type="inheritedJdk" /> ... </component>
project.properties
# This file is automatically generated by IntelliJ IDEA
but since build.gradle , project.iml and project.properties do not ship with .apk, I cannot think of a way to get the compileSdkVersion command at runtime or unzip .apk
source share