How to update minimum SDK version in Android Studio project

I’m trying to update my Android project’s minimum SDK from API 12 to API 14 but running into issues. I already modified the manifest file like this:

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="19" />

After making this change and rebuilding everything, Android Studio still shows errors in the IDE. It seems like the IDE isn’t recognizing my updated minimum SDK settings. I think there might be another place where I need to configure this, maybe in some project settings or configuration file, but I can’t figure out where exactly. Does anyone know what other files or settings need to be updated when changing the minimum SDK version?

It’s crucial to note that along with updating the manifest, you also need to revise your app’s build.gradle file. Ensure that within the defaultConfig section, the minSdkVersion is set to 14. After saving the changes, sync Gradle and conduct a clean build to implement the updates. If Android Studio continues to show errors, verify that all your external libraries are compatible with API level 14, as any incompatibilities can lead to further complications.

The Problem:

You’re attempting to update the minimum SDK version for your Android project, but Android Studio isn’t reflecting the changes you’ve made in your AndroidManifest.xml file. You’ve updated the minSdkVersion attribute, but the IDE still shows errors, suggesting the IDE hasn’t recognized the update.

:thinking: Understanding the “Why” (The Root Cause):

While updating the AndroidManifest.xml file is a necessary step, it’s not the only place where the minimum SDK version is defined within an Android project. Android Studio and the Gradle build system also use this setting to determine compatibility with libraries and other project components. If the minSdkVersion in the build.gradle file differs, it overrides the manifest setting, leading to conflicts. The IDE might also cache old settings and require a refresh to pick up the change. This can lead to persistent error messages, even after modification of the manifest file.

:gear: Step-by-Step Guide:

Step 1: Update the build.gradle File:

The most common cause of this issue is a discrepancy between the minSdkVersion in your AndroidManifest.xml and your module-level build.gradle file (usually located at app/build.gradle). You need to ensure both settings match. Open your app/build.gradle file (not the project-level build.gradle) and locate the defaultConfig block within the android block. Modify the minSdkVersion within this block to match the value in your manifest (14 in your case):

android {
    defaultConfig {
        minSdkVersion 14 //This line must be updated
        targetSdkVersion 19
        // ... other configurations ...
    }
    // ... other configurations ...
}

Step 2: Sync Project and Clean/Rebuild:

After saving the changes to your build.gradle file, click “Sync Project with Gradle Files” in Android Studio (usually a button with an elephant icon). Then perform a clean build. You can do this by selecting “Build” → “Clean Project” followed by “Build” → “Rebuild Project”.

Step 3: Invalidate Caches (If Necessary):

If Android Studio still displays errors after syncing and rebuilding, it might be necessary to invalidate the IDE’s caches. Go to “File” → “Invalidate Caches / Restart…”. Select “Invalidate and Restart” to clear the IDE’s cache and restart Android Studio. This forces the IDE to reload the project with the updated settings.

Step 4: Check gradle.properties:

Some Android projects might have custom settings in the gradle.properties file which might override settings within build.gradle. Check if gradle.properties contains any property overriding minSdkVersion, and if so, remove or modify it.

Step 5: Verify Dependencies:

Ensure that all your project’s dependencies (libraries) are compatible with API level 14. Any library with a higher minimum SDK requirement will cause build errors. Check your dependencies section in build.gradle for any potential compatibility issues.

:mag: Common Pitfalls & What to Check Next:

  • Incorrect build.gradle File: Double-check that you’re modifying the correct build.gradle file—the module-level one (usually app/build.gradle), not the project-level one.
  • Gradle Version: An outdated Gradle version might be interfering. Check your Gradle wrapper properties and ensure it is up to date.
  • Library Conflicts: If you still have errors after these steps, carefully examine your project’s dependencies to identify any potential conflicts.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!

Had the exact same issue when I migrated a project last year. That manifest approach is deprecated now - everything goes through build.gradle. Check your app-level build.gradle (not the project one) and find the android block. Update minSdkVersion to 14 there. Then do a clean rebuild and restart Android Studio completely. The IDE loves caching old values, so it needs that fresh start. One gotcha - some third-party libraries might need a higher minimum SDK. You’ll either need to update those libraries or bump your minimum SDK to match. Build errors usually catch this, but check your dependencies section just in case.

you might wanna look in your app’s build.gradle file too. love to help but just updating the manifest isn’t enough, you gotta change minSdkVersion there to 14 for it to actually work.

Alice’s right about build.gradle, but here’s how to avoid this mess going forward.

The problem is Android projects have SDK versions scattered everywhere - manifest, build.gradle, plus different module configs that get out of sync constantly.

I’ve hit this same issue across dozens of work projects. Ended up automating the whole SDK update process with Latenode. Built a workflow that auto-updates all the files when I bump SDK versions across multiple projects.

It checks build.gradle files, manifests, and validates dependencies work with the new SDK. Saves hours of manual work and kills those sync errors Android Studio loves throwing around.

Quick fix: update minSdkVersion in app/build.gradle under the android block, then clean/rebuild. But if you’re juggling multiple projects or do this often, automation’s worth it.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.