Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle cannot find the SDK platform your app compiles against

ErrorCould not find compile target android-30 for modules :app

Short answer

The compileSdk value in your module names an Android platform that is not installed in the SDK Android Studio uses. Install that platform from SDK Manager or with sdkmanager, or change compileSdk to a platform you already have. Also check that the SDK location you installed into is the one the project uses.

  • Applies to Android Studio current stable, Android Gradle Plugin 8.x, sdkmanager current
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    List the platforms installed in your SDK and compare them with the compileSdk value in app/build.gradle(.kts).

    sdkmanager --list | grep "platforms;android"
    grep -n "compileSdk" app/build.gradle*
  2. 2Match what you see, then jump to its fix

    1. 1compileSdk = 30 (or the number in the error) has no matching platforms;android-30 entry marked installed.The platform that compileSdk names is not installedFix
    2. 2Several newer platforms are installed, but compileSdk names an older one that was removed.compileSdk should point to a platform you already haveFix
    3. 3The platform is installed, yet the error remains.You installed into a different SDK folder than the project usesFix

What does the error look like?

  • Could not find compile target android-30 for modules :app

Cause 1 of 3

The platform that compileSdk names is not installed

1Check

SDK Manager downloads each platform into the Android SDK Location. At least one platform must be installed so the app can be compiled, and compileSdk selects which one.

sdkmanager --list

2Fix

Install the platform in Tools > SDK Manager > SDK Platforms, or from the command line.

sdkmanager "platforms;android-30"

3Verify

The platform is listed as installed, and the Gradle sync finishes.

sdkmanager --list | grep "platforms;android-30"

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

compileSdk should point to a platform you already have

1Check

The compileSdk property sets which Android SDK version is used to compile your Kotlin or Java code.

grep -n "compileSdk" app/build.gradle*

2Fix

Set compileSdk to an installed platform number, or install the version the project expects.

android {
    compileSdk = 36
}

3Verify

Sync the project and build.

./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

You installed into a different SDK folder than the project uses

1Check

SDK Manager puts every package into the directory shown as Android SDK Location. Compare it with the SDK that Android Studio reports for this project.

echo "$ANDROID_HOME"
sdkmanager --list

2Fix

Install the platform into the SDK location the project uses, or set Android SDK Location in SDK Manager to the folder that has it, then sync.

sdkmanager --sdk_root="$ANDROID_HOME" "platforms;android-30"

3Verify

Sync finishes without the compile target error.

./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Move compileSdk to the latest installed platform when you update the project.
  • Install the platforms a project needs with a sdkmanager line in your CI or setup script.
  • Keep one SDK folder per machine and point Android Studio and ANDROID_HOME at it.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Gradle cannot find the Android SDK on this machine

FAILURE: Build failed with an exception. What went wrong: SDK location not found.

Gradle looks for the Android SDK in the sdk.dir line of android/local.properties and in the ANDROID_HOME environment variable, and found neither.

4 causes, each with a fix

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.