0

I want to know which target the apk is aiming, I use apktool to decompile the apk file, but I can't find the sdk info in the decompiled apk files, but only in the apktool.yml file like this:

sdkInfo:  
  minSdkVersion: '14'  
  targetSdkVersion: '23' 

I wonder where can Android system find the information in the apk that installed in the phone? Why I can't find the information in the decompiled files?


update:

There are suspicious information in decompiled AndroidManifest.xml file, but there are consistent with the information in the apktool.yml file.

Thanks in advance.

twlkyao
  • 14,302
  • 7
  • 27
  • 44
  • Possible duplicate of [How to view AndroidManifest.xml from APK file?](http://stackoverflow.com/questions/4191762/how-to-view-androidmanifest-xml-from-apk-file) – 1615903 Mar 21 '17 at 10:53
  • also check this [answer](http://stackoverflow.com/a/8301038/5993410) – Atef Hares Mar 21 '17 at 10:56
  • @AtefHares I want to know how the Android system know this with the AndroidManifest.xml does not contains the information(at least in the decompiled files not same as the information in the apktool.yml file) – twlkyao Mar 21 '17 at 12:52

3 Answers3

1

AndroidManifest.xml files containts those values:

minSdkVersion targetSdkVersion

https://ibotpeaches.github.io/Apktool/

Use apktool to decode your APK-file.

Vyacheslav
  • 26,359
  • 19
  • 112
  • 194
  • @AtefHares Ok. But it stores inside this file new values. Android OS detectes supported versions by parsing this file. – Vyacheslav Mar 21 '17 at 10:43
  • @AtefHares After I decompile I can't find neither minSdkVersion nor targetSdkVerion, but platformBuildVersionCode and platformBuildVersionName, but they are not consistent with the sdk info in apktool.yml. – twlkyao Mar 21 '17 at 10:48
1

The following command will print out the xmltree of the android manifest inside an apk file:

aapt dump xmltree file.apk AndroidManifest.xml

Sample output:

N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=17)
    A: android:versionCode(0x0101021b)=(type 0x10)0x7
    A: android:versionName(0x0101021c)="2.1-update1" (Raw: "2.1-update1")
    A: package="com.android.spare_parts" (Raw: "com.android.spare_parts")
    E: uses-sdk (line=0)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0x7
      A: android:targetSdkVersion(0x01010270)=(type 0x10)0x7
    E: uses-permission (line=19)
      A: android:name(0x01010003)="android.permission.SET_ANIMATION_SCALE" (Raw: "android.permission.SET_ANIMATION_SCALE")
    E: uses-permission (line=20)
      A: android:name(0x01010003)="android.permission.CHANGE_CONFIGURATION" (Raw: "android.permission.CHANGE_CONFIGURATION")
    E: uses-permission (line=21)
      A: android:name(0x01010003)="android.permission.WRITE_SETTINGS" (Raw: "android.permission.WRITE_SETTINGS")
    E: application (line=23)
      A: android:label(0x01010001)=@0x7f060000
      A: android:icon(0x01010002)=@0x7f020000
      E: activity (line=26)
        A: android:name(0x01010003)="SpareParts" (Raw: "SpareParts")
        E: intent-filter (line=27)
          E: action (line=28)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=29)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
          E: category (line=30)
            A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")

Here, you can see on lines 7 and 8 the minSdkVersion and targetSdkVersion. Source

1615903
  • 32,635
  • 12
  • 70
  • 99
-1

You can find it in your app / main module level build.gradle file.

In below section

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'
    defaultConfig {
        applicationId "yourApplicationPackage"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
}

minSdkVersion 14

targetSdkVersion 23

Mihir Trivedi
  • 1,458
  • 18
  • 39