9

I'm using android studio 0.8.4 when I extend @style/Theme.AppCompat.Light, android studio says can't resolove symbol 'Theme' with red font colored Theme. but when I run this project, it runs well. I can't know how to solve this problem. belows are 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>
Cinakyn
  • 648
  • 1
  • 7
  • 20
  • I think you have to missed out this library appcompactv7 dependency to your project. – Haresh Chhelana Aug 04 '14 at 09:53
  • possible duplicate of [IDE "Cannot Resolve @style/Theme.Appcompat" when using v7 compatibility support theme](http://stackoverflow.com/questions/17870303/ide-cannot-resolve-style-theme-appcompat-when-using-v7-compatibility-support) – Scott Barta Aug 04 '14 at 16:09
  • @Scott Barta every answers in that question isn't work. and symptom is also diffrent. I'm using ANDROID STUDIO 0.8.4 but that problem is solved in ANDROID STUDIO 0.2.x – Cinakyn Aug 05 '14 at 05:18

3 Answers3

4

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

This bug is because of gradle 0.12.2 So I changed gradle version from 0.12.+ to 0.12.1 and It works well.

Cinakyn
  • 648
  • 1
  • 7
  • 20
0

The problem is not with the way the application is built (i.e. merging styles from external libraries). The problem is that the Android Studio XML editor is not aware of the resources in the external libraries.

This problem is already being answered by many please have a look at it

IDE "Cannot Resolve @style/Theme.Appcompat" when using v7 compatibility support theme

Community
  • 1
  • 1
Dharmendra Pratap Singh
  • 1,332
  • 1
  • 11
  • 22
0

This is bug because of low gradle you could download gradle from this reference and replace it with old gradle.

Second solution is update your android studio to newer version.

third Solution is Invalidate / Cache restart.

Hope it help.

Community
  • 1
  • 1