You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android项目修改minSdk为26后资源链接失败求助

Fixing Android Resource Linking Errors After Setting minSdkVersion to 26

Hey there, let's work through these resource linking errors together—since this is your first Android project, I'll keep things clear and actionable, no jargon overload.

1. Resolve android:attr/dialogCornerRadius, fontVariationSettings, and ttcIndex Errors

These attributes are part of Android API Level 28 (Android 9.0) and newer. Even though you set minSdkVersion to 26, if your project's compileSdkVersion or targetSdkVersion is lower than 28, the compiler won't recognize these newer system attributes.

Here's how to fix it:

  • Open your app-level build.gradle (Module: app) file.
  • Update compileSdkVersion and targetSdkVersion to at least 28 (I recommend using a newer stable version like 33 or 34 for better compatibility):
android {
    compileSdkVersion 34 // Or 33/28—use the latest stable version you have installed
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 26
        targetSdkVersion 34
        // ... other existing settings
    }
    // ... other configurations
}
  • Sync your project with Gradle (click the "Sync Now" prompt that pops up) and try rebuilding.

2. Fix Missing Drawable Resources (edit_text_background_dark_round, ic_down_arrow)

These errors mean your project can't locate the specified drawable files. Try these checks:

  • Navigate to your project's res/drawable (or res/drawable-v21, etc.) folders and verify if these files exist. If they're missing:
    • If you created these drawables yourself, restore them from a backup or recreate them using Android Studio's Vector Asset Studio (right-click res/drawable > New > Vector Asset).
    • If these drawables come from a third-party library (like Firebase UI or another dependency), ensure the library version matches your updated compileSdkVersion. You might need to bump the library's version in your build.gradle dependencies block.
  • Double-check file names: Android is case-sensitive, so make sure the filename matches exactly what's referenced (e.g., ic_down_arrow.xml instead of IC_Down_Arrow.xml).

3. Additional Troubleshooting Steps

If the above fixes don't resolve the issue, try these common go-to fixes for resource conflicts:

  • Invalidate Caches and Restart: Go to File > Invalidate Caches... > Invalidate and Restart. This clears Android Studio's cached resources that might be causing weird conflicts.
  • Clean and Rebuild: Click Build > Clean Project, then Build > Rebuild Project to rebuild all resources from scratch.

If you hit any roadblocks while trying these steps, just let me know—I’m happy to walk you through further details!

内容的提问来源于stack exchange,提问作者davidsumyhero

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:24:10