Skip to content

Resolving Compile SDK Conflict with Androidx.Activity 1.8.0

Problem Statement

When building an Android project using the com.google.android.material:material:1.10.0 dependency, you may encounter this critical build error:

An issue was found when checking AAR metadata:

1. Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that
   depend on it to compile against version 34 or later of the
   Android APIs.

   :app is currently compiled against android-33.

Also, the maximum recommended compile SDK version for Android Gradle
plugin 8.0.2 is 33.

This occurs because the Material library v1.10.0 includes a dependency on Androidx Activity v1.8.0, which mandates compiling against Android API Level 34 (Android 14) or higher. However, your project is configured for compileSdk 33 (Android 13), creating a version mismatch. The Android Gradle plugin (v8.0.2) also caps the recommended compile SDK at 33, compounding the issue.

The optimal solution matches Android's official recommendation: upgrade your project to use API Level 34.

Implementation Steps

  1. Open module-level build.gradle in your app module
  2. Update compileSdk and targetSdk values:
groovy
android {
    namespace 'com.your.app'
    compileSdk 34  // Update from 33
    defaultConfig {
        applicationId "com.your.app"
        minSdk 24
        targetSdk 34  // Update from 33
        // ... other configurations
    }
    // ... remaining configurations
}
  1. Update Android Gradle Plugin in project-level build.gradle:
groovy
// Top-level build.gradle
plugins {
    id 'com.android.application' version '8.2.0' // or higher
    // ...
}
  1. Sync Gradle and rebuild your project

Recommended Action Flow

Alternative Solution: Downgrade Material Library

If temporarily upgrading SDK isn't viable, downgrade the Material library to a version compatible with API 33:

groovy
dependencies {
    // Replace with:
    implementation 'com.google.android.material:material:1.9.0'
    // Other dependencies remain unchanged
}

Compatibility Notice

Material VersionRequired compileSdkNotes
1.10.034+Requires Android 14 API
1.9.033Compatible with Android 13
1.8.033Last of v1.8 series

Explanation

Why This Happens

Android dependencies progressively adopt newer platform features. The androidx.activity:activity:1.8.0 contains Android 14-specific bytecode, triggering an enforcement mechanism in the Android build system. The dependency chain looks like:

material:1.10.0 
→ activity:1.8.0 
→ Requires compileSdk 34

Solution Comparisons

ApproachProsCons
Update to compileSdk 34Future-proof, supports latest featuresRequires compatibility testing
Downgrade MaterialQuick fix, no SDK update neededMissing latest Material Design features
Exclude activity moduleAvoids SDK upgradeMay cause runtime crashes

Avoid Anti-Patterns

Never use these problematic workarounds:

properties
# gradle.properties - Hides actual issue
android.suppressUnsupportedCompileSdk=34
groovy
// Arbitrary dependency exclusion - unstable
implementation("com.google.android.material:material:1.10.0") {
    exclude(group: "androidx.activity", module: "activity")
}

Verification Steps

After applying the solution:

  1. Clean project (Build > Clean Project)
  2. Invalidate caches (File > Invalidate Caches)
  3. Verify SDK settings in build.gradle
  4. Sync project with Gradle files
  5. Build project (Build > Make Project)

Expected result: The dependency error disappears, and your app builds successfully.

Tip: Always match major version numbers between AndroidX libraries (e.g., Material v1.9.x works best with AppCompat v1.6.x).