Android "compileSdkVersion is not specified" in CI
The Android Gradle plugin needs a compile SDK to know which android.jar to compile against. When compileSdk is missing from the module build file, configuration fails because the platform cannot be resolved.
What this error means
The build fails with "compileSdkVersion is not specified. Please add it to build.gradle" or "compileSdk is not specified."
> compileSdkVersion is not specified. Please add it to build.gradleCommon causes
No compileSdk in the module build file
The android {} block omits compileSdk, so the plugin has no platform to compile against.
A variable for the SDK resolved to nothing
A compileSdk set from a project property or catalog that is empty leaves the value unspecified at configuration time.
How to fix it
Declare compileSdk in the module
- Add
compileSdkto the moduleandroid {}block. - Ensure the matching SDK platform is installed on the runner.
- Re-run the build.
android {
compileSdk = 34
}Install the platform in CI
Make sure the chosen compile SDK platform is present so the plugin can resolve android.jar.
- run: sdkmanager "platforms;android-34"How to prevent it
- Set
compileSdkexplicitly in every Android module. - Install the matching SDK platform on the runner.
- Verify catalog or property values for the SDK are non-empty.