我的项目构建并运行顺利,但在styles.xml中"主题"以红色突出显示,每次我将项目提交给Git时都会注意到此错误:
Error:(4, 36) Cannot resolve symbol 'Theme'
styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
请注意,我已尝试将项目与gradle文件同步,并确保google()
中的build.gradle
存在于{{1}}中,如这些问题的答案中所述:
1] Android Studio 3.0 cannot resolve symbol Theme
2] Cannot resolve symbol 'Theme' in styles.xml (Android Studio)
这些问题中接受/最高投票的答案并没有解决我的问题,请帮助
答案 0 :(得分:6)
要解决此问题,请从 build.gradle
中删除这些库com.android.support:appcompat-v7:27.1.1
com.android.support:design:27.1.1
同步并撤消删除并再次同步