targetSdkVersion cannot be higher than the compileSdkVersion simply because we cannot target things that we know nothing about during compilation. Ideally, the compileSdkVersion and targetSdkVersion should be equal and both point to the latest SDK.9 Haz 2021