htafoya htafoya - 11 months ago 48
Android Question

Android Studio - where is targetsdk number taken from?

I have a project that has the following target configs in gradle file:

compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '21.1.2'
defaultConfig {
applicationId ""
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true

The Android-manifest, event when supposedly is ignored by gradle, also have the target sdk 23:

android:targetSdkVersion="23" />

However, when I create the APK, and I check it with appt, the result is the following:

A: android:minSdkVersion(0x0101020c)=(type 0x10)0xb
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x17

Meaining that the target version is set to 17.

I have other libraries as dependencies, but some have targetsdk=4, so I don't think it is getting the lower one.

However, compileSDK is at its lowest 17, but changing this on the libraries generate some errors as some of the code has been deprecated.

Before I adventure to change this, am I doing something wrong or why my project's apk is not taking the specified targetSdk?

Answer Source

0x17 is a hexadecimal number because of the leading 0x. In decimal notation this is 23. I suggest reading this Wikipedia article to get an overview of hexadecimal numbers.