Gradle cannot find the SDK platform your app compiles against
Could not find compile target android-30 for modules :appShort 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.
Fix it fast
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*2Match what you see, then jump to its fix
- 1
compileSdk = 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
Several newer platforms are installed, but compileSdk names an older one that was removed.compileSdk should point to a platform you already haveFix - 3
The platform is installed, yet the error remains.You installed into a different SDK folder than the project usesFix
- 1
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 --list2Fix
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
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:assembleDebugConfirmed by developer.android.com
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 --list2Fix
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:assembleDebugConfirmed by developer.android.com
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 fixMobile apps
A library needs a higher compileSdk than your module sets
Execution failed for task ':app:checkDebugAarMetadata'.
A dependency declares a minimum compileSdk, and your module compiles against a lower one.
3 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile 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 fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fix