无法在styles.xml中解析符号'Theme.AppCompat.Light.DarkActionBar' [英] Cannot resolve symbol 'Theme.AppCompat.Light.DarkActionBar' in styles.xml

查看:2921
本文介绍了无法在styles.xml中解析符号'Theme.AppCompat.Light.DarkActionBar'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Theme.AppCompat.Light.DarkActionBar不在styles.xml中编译。我在应用模块的
build.gradle中添加了 compile'c​​om.android.support:appcompat-v7:25.1.0' code>。



我在谷歌搜索解决方案。它们中的很多都是关于更改Project的 build.gradle 中的类路径,但它仍然显示相同的错误。

  build.gradle 

依赖项{
编译'com.android.support:appcompat-v7:25.1.0'
compile'c​​om。 android.support:design:25.1.0'
compile'c​​om.android.support:support-annotations:25.1.0'
compile'c​​om.android.support:cardview-v7:25.1.0'
compile'c​​om.android.support:recyclerview-v7:25.1.0'
// compile'c​​h.acra:acra:4.5.0'

testCompile'junit: junit:4.12'
}

android {
compileSdkVersion 25
buildToolsVersion '25 .0.2'

defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode = 146
versionName =0.6.65
}


解决方案

您的build.gradle版本就是错误的版本。



按照以下说明修正:

$ b


  • 在Android studio中,转到左边的Gradle脚本部分
  • 找到文件: build.gradle(Project:{your_project_name})

  • 在该文件中查看 com.android.tools.build:gradle

  • 检查版本是否与您的android studio匹配版本(例如2.3.3)。这意味着 com.android.tools.build:gradle:2.3.3 以及一个2.3.3版本的Android studio分发版。

  • 验证版本是一样的。如果不是这种情况,请确保它们匹配。

  • 重建项目,一切正常!


Theme.AppCompat.Light.DarkActionBar is not compiling in styles.xml. I have added compile 'com.android.support:appcompat-v7:25.1.0' in app module's build.gradle.

I have searched for solution in google. A lot of them are about changing the classpath in Project's build.gradle.Still its showing the same error.

build.gradle

dependencies {
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.support:support-annotations:25.1.0'
    compile 'com.android.support:cardview-v7:25.1.0'
    compile 'com.android.support:recyclerview-v7:25.1.0'
    //    compile 'ch.acra:acra:4.5.0'

    testCompile 'junit:junit:4.12'
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 25
        versionCode = 146
        versionName = "0.6.65"
    }

解决方案

Your build.gradle version is simply the wrong one.

Follow these instructions to fix that:

  • In Android studio, go to the Gradle scripts section in the left panel.
  • Find the file: build.gradle(Project:{your_project_name})
  • In that file look at the line com.android.tools.build:gradle
  • Check that the version match with your android studio version (for instance 2.3.3). This implies that com.android.tools.build:gradle:2.3.3 and And an Android studio distribution with 2.3.3 as version.
  • Validate the versions are the same. If it's not the case, make sure they match.
  • Rebuild the project and everything is fine!

这篇关于无法在styles.xml中解析符号'Theme.AppCompat.Light.DarkActionBar'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆