5

Red highlight means Cannot resolve symbol 'Theme'

enter image description here

Here are some configurations :

styles.xml

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
    <item name="android:windowNoTitle">true</item>
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <item name="android:windowNoTitle">true</item>
</style>

.

AndroidManifest.xml

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />

...

android:theme="@style/AppTheme">

.

build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.0.0'
}

...

android {
    compileSdkVersion 19
    buildToolsVersion '20.0.0'
    defaultConfig {
    applicationId 'com.mobile.slider'
    minSdkVersion 8
    targetSdkVersion 19

.

MainActivity.java

public class MainActivity extends Activity {

It is working nice with my phone Nexus 4 whose android version is 4.4.4. Even though, There is no build problem, NoTitleWindow Mode doesn't work for
another phone which has 2.3.3 android version.

codelovesme
  • 3,049
  • 1
  • 16
  • 18
  • 1
    Is appcompat-v7:19.0.0 in your external libraries folder? And is the dependency set in rightclick on project - open module settings - your module name - dependencies? – tritop Aug 14 '14 at 08:38
  • I had added appcompatv7 project as a module but I have forgotten to show it to my application module. Just I have realized and fixed. Now it doesn't alert me anymore. Thanks for your reply. – codelovesme Aug 14 '14 at 08:57
  • @codelovesme what do you mean by "show it to my application module" ? Thank you in advance – Pavlos Jun 15 '17 at 10:52
  • You need to attach appcompactv7 to the application module. But I am not sure where in the panel to do that, right now I am not developing Android right now. – codelovesme Jun 20 '17 at 07:34

5 Answers5

5

This is how I solved it:

  1. Go to your project directory (or to Project View)
  2. Go into the .idea directory
  3. Remove caches and libraries directories
  4. File -> Invalidate Caches / Restart

Should be OK now.

Ognyan
  • 13,452
  • 5
  • 64
  • 82
2

I had added appcompatv7 project as a module but I have forgotten to show it to my application module. Just I have realized and fixed. Now it doesn't alert me anymore. Thanks for your reply, tritop.

codelovesme
  • 3,049
  • 1
  • 16
  • 18
0

It's very weird but I had the dependency in my .gradle.

To solve the issue I deleted it(//commented), sync, get all error because of it, put the dependency again, sync again. Then the problem was gone!

crgarridos
  • 8,758
  • 3
  • 49
  • 61
0

Only this worked for me!

  • Close project (File> Close Project)
  • Import / Re-Open project again (NOT from Recent)

Error should be resolved now.

If that did not resolve, then try below

  • Open build.gradle, remove appcompact-v7 dependency line and sync.
  • Again add appcompact-v7 dependency and sync.

Issue must be resolved!

Community
  • 1
  • 1
Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212
0

Just delete the dependencies below and sync. Paste them again and sync.

implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
Martin Mbae
  • 1,108
  • 1
  • 16
  • 27