3

My project builds and runs smoothly however in styles.xml the "Theme" is highlighted in red and this error is brought to my notice each time I commit my project to 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>

Note that I have tried syncing my project with gradle files and have ensured that google() is present in my buildscript block in build.gradle as mentioned in the answers to these questions:

1] Android Studio 3.0 cannot resolve symbol Theme

2] Cannot resolve symbol 'Theme' in styles.xml (Android Studio)

The accepted/top voted answers in these questions did not solve my problem, please help

Kewal Shah
  • 1,131
  • 18
  • 29

1 Answers1

6

To fix this problem delete these libraries from build.gradle

com.android.support:appcompat-v7:27.1.1

com.android.support:design:27.1.1

sync and undo delete and sync again

Community
  • 1
  • 1
venu46
  • 419
  • 5
  • 10
  • Is this safe? because I'm unable to build my project after removing `com.android.support:appcompat-v7:27.1.1` getting an error : `AAPT2 error: check logs for details` – Kewal Shah Jun 05 '18 at 06:54
  • please re-add those dependencies again from **build-Edit libraries and Dependencies** which are latest versions and resync the project – venu46 Jun 05 '18 at 09:40
  • I see you had edited your answer adding the phrase "undo delete", which I didn't see. This solved solved my problem, thank you! – Kewal Shah Jun 05 '18 at 09:59