M
M
mitaichik2016-04-06 00:08:12
Android
mitaichik, 2016-04-06 00:08:12

What is compileSdkVersion and targetSdkVersion?

Hello! Tell me what do compileSdkVersion and targetSdkVersion mean? And how to ask them correctly?
I have the following settings:
minSdkVersion 9
compileSdkVersion 21
targetSdkVersion 20
buildToolsVersion '21.0.1'
Well, it's clear that compileSdkVersion is the version on which the project is compiled. But if the phone has an OS version less or more, will the application work? Same question for targetSdkVersion.
Plus, Android Studio began to swear at
compile 'com.android.support:support-v4:20.+'
compile 'com.android.support:appcompat-v7:20.+'
They say the package version is less than compileSdkVersion. I didn’t swear before .... Is this normal? Because when I make version 21 of the packages, it breaks the whole actionbar for me ....
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Shatunov, 2016-04-06
@mitaichik

Versions of the Android API are backward compatible within certain limits. This literally means that you can build an application for Android 4.4.2 (targetSdkVersion == 19) using the Android API version 22 (compileSdkVersion == 22). At the same time, the responsibility for preventing calls to new functions from Android 5.1.1 on older platforms falls entirely on your hands. Otherwise, the application will crash, no one provides autoplugs.
Therefore, yes, you can use the latest versions of the Android API to build for older versions of the Android OS.
Regarding warnings about different versions, you have compileSdkVersion strictly specified, but the "com.android.support" package has a flexible dependency on versioning. Most likely, you have already downloaded the fresh APIs for Android 5/6, from which the "com.android.support" package is now taken during the build.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question