Recently, I have started adopting many of the open-source apps for my phones for convenience. Often, my friends tend to have a pre-compiled version of the app (or their own implemented mini-apps) that I tend to use. Unfortunately, the complied apps require minimum OS in some cases, which my phone didn’t satisfy. This was an annoying problem where the compatibility issue is discovered only after or while loading the app on the phone.

Fortunately, a more straightforward solution is to extract the minimum support version from ipa for iOS and the apk for android.

iOS

The binary for the iOS system with the extension ipa is a form of compression which means that we can unzip it and do a quick check. The following command in the directory where the ipa file is located would print in the minimum OS that the binary required.

unzip -q myapp.ipa && plutil -p Payload/myapp.app/Info.plist | grep MinimumOSVersion

It would return the following:

  "MinimumOSVersion" => "10.0"

Ofcourse its a good idea to delete the extracted folders SwiftSupport, Payload and optionally, BCSymbolMaps.

Android

The Android OS can be a bit tricky. It does not work out-of-box; rather, you need to have the Android SDK installed on your machine. Within the SDK, there is a tool named aapt that allows checking inside the compiled apk.

First, ensure that you have the aapt inside your path. In most cases, it would be installed at the place where the build-tools is installed. On macOS the default location is $HOME/Library/Android/sdk/build-tools/[VERSION]. For ease of use, it is better to add aapt to your PATH as follows:

export PATH="$HOME/Library/Android/sdk/build-tools/[VERSION]:$PATH"

Now, you can call in the aapt and chain it with normal grep and sed to get the minimum SDK that the apk supports. For example,

aapt l -a my_app.apk | grep minSdkVersion | sed 's/^.*0x10)/ /' | { echo "minSdkVersion => $(($(cat)))" }

which would output:

minSdkVersion => 25