What wrong with my Style? cannot resolve symbol Theme.AppCompat.Light.NoActionBar

半腔热情 提交于 2019-11-27 08:10:18

问题


Currently, my styles.xml file show something not properly. Theme.AppCompat.Light.NoActionBar cannot be resolve. I have restart android studio but it still not work. I tried Invalidate Caches/Restart, but it not work. It doesn't make my app crash, but why It occurs. Look below image:

This is my build.gradle file

import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "xx.com.xxx.xxxx"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 21
        versionName "1.2.0"
        renderscriptTargetApi 23
        renderscriptSupportModeEnabled true

        // Enabling multidex support.
        multiDexEnabled true
    }

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.afollestad.material-dialogs:core:0.8.5.1@aar') {
        transitive = true
    }
    compile('com.mikepenz:actionitembadge:3.0.2@aar') {
        transitive = true
    }
    compile project(':blurringview')
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.android.support:palette-v7:23.3.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.wdullaer:materialdatetimepicker:1.5.1'
    compile 'com.pnikosis:materialish-progress:1.5'
    compile 'com.mikepenz:iconics:1.3.0@aar'
    compile 'com.mikepenz.iconics:community-material-typeface:+@aar'
    compile 'com.soundcloud.android:android-crop:1.0.0@aar'
    compile 'org.apache.commons:commons-lang3:3.4'
     ...
}

...
}

回答1:


Finally, here is my first solution. The error happen because gradle not work with the libraries which has lower version. It doesn't compile the external library appcompat-v7:23.3.0. What I do now is downgrade gradle plugin frorm 2.+ to 2.2.0 and rebuild project. It works again now.

This link show how to downgrade version gradle [Link].

It is not a good idea, thought, but It did saved my problem.

Any other ideas or comments to improve, welcome.




回答2:


  1. Exit Android studio.
  2. Go to your project directory.
  3. Something like this in my case( F -> Android -> YourProjectName -> .idea).
  4. Delete libraries folder present in .idea folder.
  5. Restart your Android Studio and your issue is resolved.


来源:https://stackoverflow.com/questions/40757931/what-wrong-with-my-style-cannot-resolve-symbol-theme-appcompat-light-noactionba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!