The overwhelming advice on SO is that the compilation SDK should usually match the target SDK.
Really? I would expect a small number of Android applications to be configured outside of the newly created projects, where the wizards of the new project tend to set equal values โโfor them.
what harm in their creation corresponds
There is no particular harm in their coincidence. There is no particular harm if they do not match. It all depends on what you write and what behavior you want.
For example, Android 6.0 introduces a new run-time permission model in which you need to add code to the application to request dangerous permissions from the user for everything from WRITE_EXTERNAL_STORAGE to READ_CONTACTS . However, this is used only if targetSdkVersion is 23 or higher. If you are currently unable to handle this code change, you specifically leave your targetSdkVersion at something lower, for example 22.
However, at the same time, you might want to use the v23 releases for the main supporting Android libraries, for example appcompat-v7 . Generally speaking, you want your compileSdkVersion match the major version of the supported libraries that you use, since they can reference classes, methods, constants, and those that are available only in this compileSdkVersion .
So, this will be the case when you specifically do not want compileSdkVersion match targetSdkVersion .
What advantage is having the youngest compiled version of sdk that you can get rid of?
There is currently no advantage, IMHO.
In 2008-2011, the general (albeit incorrect) recommendation was that compileSdkVersion match minSdkVersion (or, in truth, their Eclipse / Ant equivalents, since Android Studio did not exist then), This was because we lacked tools to automatically tell us if we used something that was really in our compileSdkVersion (say 11), but was not available before our minSdkVersion (say 4). Setting these two values โโmeans that you received compiler errors if you tried to use material newer than minSdkVersion . The disadvantage is that you are stuck with a set of functions from your minSdkVersion and could not gradually improve your application to take advantage of the new features available on newer devices.
Currently, build tools (specifically Lint) will yell at you if you try to use things that are valid in your compileSdkVersion but are not fully accessible back to minSdkVersion , so you know to set the appropriate Build.VERSION.SDK_INT check that you use only new things on new devices and competently degrade on old devices.