What wrong with my Style? cannot resolve symbol Th

2019-01-20 15:42发布

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'
     ...
}

...
}

2条回答
手持菜刀,她持情操
2楼-- · 2019-01-20 16:00
  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.
Anthone
3楼-- · 2019-01-20 16:02

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.

查看更多
登录 后发表回答