The API version shown in Android Studio's Design view is a preview setting, not your project's compiled SDK. To change it, open a layout XML file, find the API dropdown in the Layout Editor toolbar (it often reads something like "API 34" or shows a device name), and pick another installed platform. If the version you want isn't listed, install that SDK platform through SDK Manager first. Separately, your project's compileSdk, minSdk, and targetSdk values live in Gradle build files and Project Structure, and those control compilation and runtime behavior rather than the visual preview. Mixing up these two settings is the most common reason people "change the API version" and see nothing happen.

That distinction matters because the query touches both ideas. The Design view (officially the Layout Editor) has its own preview API selector. The build configuration is where the app's real API levels are declared. Below you'll find the exact steps for each, how to verify the preview actually switched, and what to do when the dropdown refuses to cooperate.

What "API Version in Design View" Actually Means

Android Studio's Layout Editor renders your XML using a library called LayoutLib, tied to a specific Android platform. The API selector in the editor toolbar tells LayoutLib which platform's widgets, attributes, and behaviors to emulate. Choose API 21 and your MaterialButton may render with fallback styling; choose API 34 and you see the modern appearance. This is purely a preview: it changes nothing in your source code, nothing in your APK, and nothing about which devices can install the app.

The Android developer documentation describes this control plainly: the API version option selects "the version of Android to preview your layout," and the list of available versions depends on which SDK platforms you've installed through SDK Manager. That last clause explains most dropdown problems. Android Studio won't offer API 35 for preview if the API 35 platform was never downloaded.

Three other settings are easy to confuse with it. compileSdk in build.gradle decides which APIs your code can reference at compile time. minSdk sets the oldest device that can install the app. targetSdk declares which behavior model the app opts into on newer Android releases. None of these directly controls the Design view's rendering target, though Android Studio sometimes initializes the preview from them when you first open a layout.

Prerequisites Before You Start

A few things should be in place, or the steps below will stall:

An open Android project with at least one XML layout under res/layout (for example activity_main.xml). The layout open in the editor; the Design/Code toggle should be visible in the top-right corner of the editor pane. Network access or a local SDK repository if you need to download a platform. Awareness of your project's current API levels, so you can tell whether the preview matches your intent. Check the module-level build.gradle or build.gradle.kts first.

If you're on a newer Android Studio release (the IDE has shipped several major versions since the Flamingo-era redesign of the editor toolbar), the controls exist but the toolbar layout differs. Look for a dropdown showing a device name and an API number grouped together; the device selector and API selector are often adjacent.

Step-by-Step: Changing the Preview API in the Layout Editor

1: Open the layout file you want to preview. Double-click it in the Project pane under app > res > layout. If the file opens in Code view, click the Design tab (or Split) at the top-right of the editor. 2: Locate the API dropdown in the Layout Editor toolbar above the canvas. It typically shows the current preview API alongside the selected device, something like "Pixel 7 – API 34." 3: Click the dropdown. A list appears with device definitions and, usually in a separate section or submenu, Android API levels you have installed. 4: Select the API level you want. The canvas re-renders. Expect a brief "Rendering" spinner; complex layouts with custom views can take a few seconds. 5: Confirm the change by reading the toolbar again, or open the Layout Validation tool window (View > Tool Windows > Layout Validation) and compare your layout across multiple API levels side by side. 6: If you also want a specific screen size or orientation at that API, set the device and orientation dropdowns next to the API selector, and use the orientation and night-mode toggles at the canvas edges.

Success looks like this: the toolbar shows your chosen API number, the rendered widgets reflect that platform's styling, and any attributes unsupported at that level fall back or show warnings. A quick check is to preview a widget introduced in a later API, such as Material 3 components, at a low API level; if the rendering changes appearance or the editor flags a warning, the switch took effect.

Step-by-Step: Changing the Project's API Levels in Gradle

If your real goal is to raise minSdk, bump compileSdk, or adjust targetSdk, the Design view is the wrong place. Do this instead:

1: In the Project pane, switch to the Android view. Expand Gradle Scripts. 2: Open build.gradle (or build.gradle.kts) for the module (usually labeled Module :app), not the project-level file. Editing the project-level file is a classic mistake and produces no effect. 3: Find the android { } block. In Groovy DSL it looks like compileSdk 34, minSdk 24, targetSdk 34; in Kotlin DSL the properties are compileSdk = 34, minSdk = 24, targetSdk = 34. Older projects use compileSdkVersion and buildToolsVersion in a similar block. 4: Change the values. Keep compileSdk at or above targetSdk; Android tooling warns or fails when targetSdk exceeds compileSdk. minSdk must be at or below both. 5: Click Sync Now in the notification bar that appears, or use File > Sync Project with Gradle Files. Watch the Build output for errors. 6: Rebuild and, if the preview doesn't follow, manually reselect the API in the Layout Editor toolbar as described above.

Members of older Stack Overflow threads described editing the manifest's element and still seeing IDE errors. That's expected: modern Android Gradle Plugin versions ignore or actively override manifest SDK declarations, and the manifest approach was deprecated long ago. The Gradle file is authoritative now. If you inherit an old project with both, delete the manifest's tag to avoid confusion.

There's also a dialog route: File > Project Structure > Modules > (your module) > Default Config surfaces minSdk and targetSdk fields, and the Properties/compile SDK section lets you pick compileSdk. This writes the same Gradle values, so use whichever interface you find clearer. The Project Structure dialog is convenient when you're unsure of the exact property names.

Why the Design View Sometimes Reverts or Ignores Your Choice

Several failure modes explain a stubborn preview.

The platform isn't installed. If the API you want doesn't appear in the dropdown, open Tools > SDK Manager (or the gear icon in the toolbar), go to the SDK Platforms tab, check the desired Android version, and click Apply. When the download finishes, the API appears in the Layout Editor list. A Stack Overflow discussion about a wearable rendering exception traced the problem to a missing SDK platform and resolved it by installing the platform and then switching the graphical layout API to the matching level.

The preview follows the project configuration. When you change compileSdk or targetSdk in Gradle and sync, Android Studio often resets the editor's preview API to match. That's a feature, not a bug: the preview stays aligned with what you compile against. Re-select your desired preview API manually after syncing if you want something different.

Rendering exceptions block the canvas. Errors like "Failed to load the LayoutLib" or System.arraycopy exceptions usually indicate a mismatch between the IDE's rendering engine and the chosen platform, or a corrupted SDK installation. Reversible checks first: switch to a different API level in the dropdown and see if the canvas recovers; then use Build > Clean Project and File > Invalidate Caches / Restart. If the same exception persists across multiple API levels and a fresh SDK platform download, the problem is likely your IDE or SDK installation rather than the setting itself, and reinstalling the affected SDK platform from SDK Manager is the next reasonable step.

Resource qualifiers override the preview. If your layout has a variant folder such as layout-v26, the preview may prefer a qualified version at higher API levels. The API selector still governs rendering, but the file being rendered can differ. The Layout Validation window makes this visible by listing which configuration each preview uses.

Custom views crash the preview. A view that calls platform APIs unavailable at the previewed level can throw during rendering. The stack trace in the error panel usually names the class. Lower the preview API cautiously or fix the custom view's guarded calls; no amount of dropdown switching will render code that genuinely fails at that level.

Design View vs. Build Configuration: A Compact Reference

Setting Where it lives What it controls Changes the app?
Preview API Layout Editor toolbar dropdown Which platform LayoutLib renders the canvas with No
compileSdk Module build.gradle / Project Structure APIs available at compile time Yes, build behavior
minSdk Module build.gradle / Project Structure Oldest installable device Yes, device compatibility
targetSdk Module build.gradle / Project Structure Behavior model opted into on newer Android Yes, runtime behavior

The table compresses a distinction worth repeating: only one row is a preview control. Everything else ships in your APK.

When to Use Layout Validation Instead

If your actual concern is "does this layout hold up across API levels," the preview dropdown is a sample of one. Layout Validation (View > Tool Windows > Layout Validation) renders your layouts across a grid of devices, API levels, font scales, and display modes simultaneously. It's the better tool for catching a constraint that breaks at API 23 while looking fine at 34. The API dropdown remains the fast way to check one specific level while you're actively editing, which is exactly the workflow the query describes.

The Android Studio release notes and the Layout Editor documentation describe these tools as part of the same editor, so treat them as companions rather than alternatives. Set the dropdown for focused work; open Layout Validation before you call the layout done.

A Worked Example

Suppose a project targets minSdk 24 and compileSdk 35, and you want to verify a button behaves correctly on Android 8.0 (API 26) because you conditionally style it there.

First, confirm the API 26 platform is installed: open SDK Manager, check the SDK Platforms list. If Android 8.0 is missing, install it. Then open activity_main.xml, click Design, and select API 26 in the toolbar dropdown. The canvas re-renders; you may see the button pick up the older styling path described in your resource qualifiers. Toggle night mode and landscape to check those variants at the same API. If the rendering looks broken only at API 26, the error panel names the offending attribute or view. Fix the code or, if the breakage is inherent to a newer attribute, add a values-v26 resource or a runtime version check. Finally, open Layout Validation for a grid view that includes API 26 alongside your other supported levels, confirming the fix doesn't regress elsewhere.

Total time for this cycle is usually a couple of minutes, most of it the SDK download if a platform is missing.

One last edge case: students and tutorial-followers sometimes work in projects generated years ago, where the module file still uses compileSdkVersion 17 and buildToolsVersion '19.1.0' as seen in older forum posts. Those projects open in modern Android Studio only after AGP and Gradle upgrades; until then, the preview selector may function but the build will fail. Upgrading the Gradle plugin and build tools is a separate task from changing the preview API, and it should be done deliberately rather than as a side effect of chasing a rendering problem.

The short version: for the Design view itself, the toolbar dropdown is the answer, backed by an installed SDK platform. For anything that affects the shipped app, edit the module's Gradle SDK values and sync. Keeping those two mental drawers separate prevents most of the confusion around this task.