PC パソコン

Android Studio “Update minCompileSdk in modules with dependencies that require a higher minCompileSdk”: Causes and Solutions

When building in Android Studio, you may see the error “Update minCompileSdk in modules with dependencies that require a higher minCompileSdk”. This occurs when the project’s compileSdk is lower than the minimum Compile SDK required by a dependency library.

What the error means

Update minCompileSdk in modules with dependencies that require a higher minCompileSdk

Android AAR libraries can specify the minimum compileSdk required by modules that consume the library through AAR Metadata. If the project’s compileSdk is lower than that value, the Android Gradle Plugin stops the build because of a compatibility problem.

Common situations where it occurs

  • You updated an AndroidX or Google library to a newer version.
  • You added a new dependency library to an older project.
  • In a multi-module project, only some modules use a lower compileSdk.
  • You updated only dependencies in the Version Catalog without updating the SDK configuration.

How to check the cause

First, check the error log and identify which dependency requires which Compile SDK version.

Dependency 'example-library' requires libraries and applications that depend on it to compile against version 35 or later of the Android APIs.

Next, open the target module’s build.gradle or build.gradle.kts and check the current compileSdk.

android {
    compileSdk = 34
}

Solution 1: Increase compileSdk

The most basic solution is to increase compileSdk to the value required by the dependency library or higher.

android {
    compileSdk = 35
}

After making the change, run Gradle Sync and build the project again.

Solution 2: Install the required SDK Platform

Even if you increase compileSdk, the build cannot succeed if the corresponding Android SDK Platform is not installed. Install the required API level from Android Studio’s SDK Manager.

Increasing compileSdk does not automatically increase minSdk. Whether older Android devices are supported is determined by minSdk.

Solution 3: Downgrade the dependency library to a compatible version

If you cannot increase compileSdk for some reason, you can return to an older version of the library that works with the current Compile SDK.

dependencies {
    implementation("com.example:library:1.2.0")
}

However, older versions may not include bug fixes or security fixes, so as a permanent solution, consider whether the SDK side can be updated instead.

Solution 4: Align compileSdk across multiple modules

In a multi-module project, check not only the app module but also the library modules it depends on. If a lower compileSdk remains in only some modules, the same error may continue.

Solution 5: Check compatibility with the Android Gradle Plugin

When using a newer Compile SDK, also confirm that the Android Gradle Plugin you are using supports that API level. Older AGP versions may not fully support newer SDKs.

Notes

The library’s minCompileSdk indicates the minimum Compile SDK required on the consuming side. Rather than ignoring the error and continuing with a lower compileSdk, the basic approach is to update the configuration to meet the required value.

Summary

If “Update minCompileSdk in modules with dependencies that require a higher minCompileSdk” appears, compare the minimum Compile SDK required by the dependency library with the compileSdk of each module. The standard solution is to increase compileSdk to the required value or higher and install the necessary SDK Platform. If that is difficult, downgrading the dependency library is another option. In a multi-module project, check the settings of all modules.