error: Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
AndroidManifest.xml 中 <application android:theme="@style/AppTheme"> 引用了 AppTheme 樣式,但專案 res/values/styles.xml 裡並未定義該樣式,導致編譯失敗。
res/values/styles.xml<resources xmlns:android="https://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="android:Theme.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@android:color/transparent</item>
</style>
</resources>
Theme.Material.Light(API 21+)Theme.AppCompat.Light.NoActionBar(使用 AppCompat 時)確認 android:theme="@style/AppTheme" 拼寫完全一致,重建專案即可。
values-v21/styles.xml 覆寫 Material 樣式。tools:replace="android:theme" 解決 Library 衝突。補上缺失的 AppTheme 定義,錯誤即刻消失。