Android Studio 3.0 cannot resolve symbol Theme

前端 未结 10 742
青春惊慌失措
青春惊慌失措 2020-12-29 20:46

As stated in style.xml, there is a weird error, which shows Cannot resolve symbol \'Theme\', which is quite strange.

See pic of the error :-

My Project Spe

相关标签:
10条回答
  • 2020-12-29 21:29

    Had the same issue after upgrading to Android Studio 3.1 (EDIT: bug still present at v3.1.3). What worked for me was clicking File > Close Project and then reopening the project from Studio's dialog.

    0 讨论(0)
  • 2020-12-29 21:35

    Goto File -> Invalidate Caches / Restart... -> Invalidate and Restart

    Android Studio will sort-of close and delete all caches, indexes, etc.. Then, Android Studio will open again. Indexing will be done and you're ready to proceed.

    0 讨论(0)
  • 2020-12-29 21:38

    What worked for me was to click on Gradle to open the Gradle projects tool window and than on refresh. I think some depedencies where not loaded correctly.

    0 讨论(0)
  • 2020-12-29 21:40

    Solution 1:

    1. GOTO > 'build.gradle(Module:app)',
    2. ADD > "buildToolsVersion '28.0.2'" as following :

    android {
        signingConfigs {}
        compileSdkVersion 28
        defaultConfig
        {
            applicationId "com.example.project"
            minSdkVersion 21
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes
        {
            release
            {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    
        buildToolsVersion '28.0.1'
    }
    
    1. Click on 'Sync Now', and it's done.
    2. GOTO > 'File' > 'Invalidate Cache/Restart'.
    3. Done.

    If That doesn't work, following might help (Solution 2) :

    1. GOTO > 'SDK Manager' > 'SDK Tools' > Click on 'Show Package Details',
    2. Check if there is a NEW Version of 'SDK Build-Tools' Available,
    3. Then Download it and Change to newer version "buildToolsVersion '28.0.x'" in 'build.gradle (Module:app)',
    4. Sync again.
    5. GOTO > 'File' > 'Invalidate Cache/Restart'.
    6. Done.

    If That doesn't work, following might help (Solution 3) :

    1. Remove/Cut following dependencies :

      implementation 'com.android.support:appcompat-v7:x.x.x'
      implementation 'com.android.support:design:x.x.x'
      
    2. Click on 'Sync Now',

    3. Add/Paste dependencies again and Sync again.
    4. Done.

    NOTE : You can do Solution 1 then 2 then 3 for better results.

    Hope it helped :)

    0 讨论(0)
提交回复
热议问题