Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to find which platform version an APK targets?

Tags:

android

Given an APK, is it possible to determine which version of Android platform it targets?

like image 253
zer0stimulus Avatar asked Nov 28 '11 18:11

zer0stimulus


People also ask

Which Android platform version is targeted when API level 19 is selected?

Android 4.4 (API level 19).

What is Android Target version?

The Target Android Version (also known as targetSdkVersion ) is the API level of the Android device where the app expects to run. Android uses this setting to determine whether to enable any compatibility behaviors – this ensures that your app continues to work the way you expect.

What is targeted SDK version?

targetSdkVersion is a property that tells the system for which Android version the app was designed and tested on.

How do I analyze an APK file?

Drag an APK or app bundle into the Editor window of Android Studio. Switch to the Project perspective in the Project window and then double-click the APK in the default build/output/apks/ directory. Select Build > Analyze APK in the menu bar and then select your APK or app bundle.


2 Answers

Use aapt:

aapt list -a package.apk | grep SdkVersion 

You will see version numbers in hex. e.g.:

  A: android:minSdkVersion(0x0101020c)=(type 0x10)0x3   A: android:targetSdkVersion(0x01010270)=(type 0x10)0xc 

For this apk, minSdkVersion is 0x3 i.e. 3, and targetSdkVersion is 0xc i.e. 12.

like image 167
chiuki Avatar answered Oct 10 '22 07:10

chiuki


Use apktool

java -jar apktool.jar d app.apk 

Then look in the generated apktool.yml file for this:

sdkInfo:   minSdkVersion: '11'   targetSdkVersion: '17' 

You can match the SDK version to Android version here. In the above example minimum Android version is 3.0 and target version is 4.2.

like image 30
miles82 Avatar answered Oct 10 '22 09:10

miles82