Skip to content
Latchkey

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."

Android
> compileSdkVersion is not specified. Please add it to build.gradle

Common 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

  1. Add compileSdk to the module android {} block.
  2. Ensure the matching SDK platform is installed on the runner.
  3. Re-run the build.
app/build.gradle.kts
android {
  compileSdk = 34
}

Install the platform in CI

Make sure the chosen compile SDK platform is present so the plugin can resolve android.jar.

.github/workflows/ci.yml
- run: sdkmanager "platforms;android-34"

How to prevent it

  • Set compileSdk explicitly in every Android module.
  • Install the matching SDK platform on the runner.
  • Verify catalog or property values for the SDK are non-empty.

Frequently asked questions

What causes ""compileSdkVersion is not specified""?
The android {} block omits compileSdk, so the plugin has no platform to compile against.
How do I fix "compileSdkVersion is not specified"?
Declare compileSdk in the module

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card