Android Studio "cannot resolve the subject symbol

I use android studio 0.8.4 when I extend @style/Theme.AppCompat.Light , Android studio says can't resolove symbol 'Theme' with the red font Theme . but when I run this project, it works well. I do not know how to solve this problem. Glory is my codes.

styles.xml

 <resources> <!-- the theme applied to the application or activity --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> </style> </resources> 

build.gradle

 apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion "20.0.0" defaultConfig { applicationId "kr.co.hiworks.office" minSdkVersion 9 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } lintOptions { disable 'InvalidPackage' } packagingOptions { exclude 'META-INF/services/javax.annotation.processing.Processor' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v4:19.+' compile 'com.android.support:appcompat-v7:19.+' compile 'com.jakewharton:butterknife:5.1.1' compile 'com.nineoldandroids:library:2.4.0' compile 'com.mcxiaoke.volley:library:1.0.6' compile 'com.github.satyan:sugar:1.3' } 

AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="kr.co.hiworks.office" > <application android:name=".BaseApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <meta-data android:name="DATABASE" android:value="hiworks_office.db" /> <meta-data android:name="VERSION" android:value="1" /> <meta-data android:name="QUERY_LOG" android:value="true" /> <meta-data android:name="DOMAIN_PACKAGE_NAME" android:value="kr.hiworks.office.models" /> <activity android:name=".activities.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 
+7
android android-studio android-actionbar
source share
3 answers

https://code.google.com/p/android/issues/detail?id=64649

This error is related to gradle 0.12.2, so I changed the version of gradle from 0.12.+ To 0.12.1 and it works fine.

+4
source share

The problem is not the way the application is created (i.e. merging styles with external libraries). The problem is that the Android Studio XML editor does not know the resources in external libraries.

This problem has already been answered by many, please take a look at it.

Cannot resolve @ style / Theme.Appcompat IDE when using v7 compatibility theme

0
source share

This is a bug due to low gradle, you can download gradle from this link and replace it with the old gradle.

The second solution is to upgrade your Android studio to a newer version.

The third solution is restart / cache.

Hope this helps.

0
source share

All Articles