The comment put by the OP under his question (mainly due to the fact that targetSDK does not affect the compilation of the application) is completely incorrect! Sorry you're stupid.
In short, here is the purpose of declaring another targetSDK from minSDK: this means that you use functions with an SDK of a higher level than your minimum, but you have provided backward compatibility. In other words, imagine that you want to use a function that was only recently introduced, but this is not critical for your application. Then you installed targetSDK in the version in which this new function was introduced, and the minimum - for something lower, so that everyone can use your application.
To give an example, let's say you are writing an application that makes extensive use of gesture detection. However, each command that can be recognized by a gesture can also be executed using the button or from the menu. In this case, the gestures are "excellent" but not required. Therefore, you must set the target sdk to 7 ("Eclair" when the GestureDetection library was introduced), and the minimum SDK to level 3 ("Cupcake") so that even people with really old phones can use your application. All you have to do is make sure that your application has checked the version of Android it was running on before trying to use the gesture library so as not to try to use it if it does not exist. (Admittedly, this is a dated example, since hardly anyone still has a v1.5 phone, but there was a time when maintaining compatibility with v1.5 was really important.)
To give another example, you can use this if you want to use a function from Gingerbread or Honeycomb. Some people will receive updates soon, but many others, particularly those with older hardware, may remain stuck with Eclair until they purchase a new device. This will allow you to use some of the new interesting features, but not excluding part of your potential market.
There is a really good article from the Android developers blog on how to use this function, and in particular how to develop a check before using it, there is a function mentioned above.
To OP: I wrote this mainly for anyone who accidentally stumbles upon this question in the future.
user647826
source share