Android Question Min & Target SDK Version

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I have my Target and min SDK set to:

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19"/>

From what I understand based on the above, it will allow any Android device running Android 4.1 or above (SDK 16+) will use the SDK from Android 4.4.

If a customer has an device that uses SDK version 18 will that have any effect to my app?

Notice I am targeting the SDK version higher than what the customer has. Should I have my min and target version the same in this case or doesn't it matter ?

In my Tools > Configure Paths, I have my android.jar file set as: C:\Android\platforms\android-24\android.jar

I guess it means I am compiling it using Android 24 and targeting my app based on the Manifest (min 16 - Target 19) ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Not exactly correct.
minSdkVersion is simple. It is the minimum version supported by your app.

targetSdkVersion is used for backwards compatibility. I will explain it with an example. Google has introduced runtime permissions in Android 6 (version 23). Forcing this feature on existing apps will break them.

So if your targetSdkVersion is 23 the OS knows that your app can handle breaking changes added in version 23 (and previous versions) and will force your app to use runtime permissions.

If the targetSdkVersion is 19 then runtime permissions will not be used.

The bottom line is:
Set the targetSdkVersion to <23 if you don't want to use runtime permissions and set it to 23 if you do. Don't set it to a higher value unless you carefully test your app on Android 7+ device.
 
Upvote 0
Top