Android Studio 3.0.1默认无多分辨率drawable目录相关问题咨询
Great question! This shift in default project structure threw a lot of developers off when Android Studio 3.x launched—let’s break down the "why" and "how" clearly.
1. Why no default ldpi/mdpi/hdpi/xhdpi/xxhdpi/xxxhdpi drawable directories?
The core reason boils down to modern Android development best practices that prioritize efficiency and simplicity:
- Vector Drawables are now the standard: Android Studio 3.0+ heavily promotes using vector graphics (
.xmlfiles) instead of bitmap assets (PNG/JPG). A single vector drawable scales perfectly across all screen resolutions, eliminating the need to create and maintain multiple bitmap versions for different DPIs. This drastically reduces APK size and cuts down on repetitive work. - Simplified project maintenance: Many developers weren’t actually providing assets for every DPI anyway—often skipping ldpi or relying on scaling from higher DPIs. Removing these directories by default keeps the project structure cleaner and avoids cluttering it with unused or redundant folders.
- Mipmaps for app icons: Adaptive icons (introduced in Android O) and launcher icons are meant to live in
mipmap-*directories instead of drawable. The drawable folder is now focused on UI assets that can be handled by vectors. - Backward compatibility for vectors: With the
vectorDrawables.useSupportLibrary = truesetting in yourbuild.gradlefile, vector drawables work seamlessly on devices running Android 4.0 (API 14) and above—so there’s no need to fall back to bitmap assets for older versions.
How to adapt for different resolutions if you still need bitmaps
If you have bitmap assets that can’t be replaced with vectors (like complex illustrations), you can manually create the DPI-specific drawable directories yourself:
- Right-click the
resfolder → New → Android Resource Directory - Set "Resource type" to
drawable, then select the desired DPI from the "Available qualifiers" list (e.g.,hdpi,xxhdpi) - Place your bitmap assets in the corresponding directory, and Android will automatically load the correct version based on the device’s screen density.
2. What’s the purpose of drawable-v21 and drawable-v24?
These are version-specific drawable directories, which let you provide different resources for devices running specific Android versions:
- drawable-v21: Targets devices running Android 5.0 (API Level 21) and above. This version introduced Material Design, which added new drawable capabilities like:
- Native vector drawable support (no need for the support library)
- Ripple effects (
RippleDrawable) for touch feedback - Shape drawables with rounded corners, shadows, and tinting
- Animated vector drawables
Any drawables placed here will override the defaultdrawablefolder resources on Android 5.0+ devices, while older devices will use the default drawables.
- drawable-v24: Targets devices running Android 7.0 (API Level 24) and above. This version expanded drawable functionality with features like:
- Improved support for adaptive icon layers
- Enhanced SVG vector features
- Additional tint modes and color state list capabilities
Use this directory if you want to leverage these newer features without breaking compatibility with older Android versions.
Example use case
Suppose you want a ripple effect on a button for Android 5.0+, but a simple color selector for older versions:
- Put your ripple drawable (e.g.,
button_background.xml) indrawable-v21 - Put your basic selector drawable with the same filename in the default
drawablefolder - Android will automatically pick the right version based on the device’s API level.
内容的提问来源于stack exchange,提问作者M.ArslanKhan

