【问题标题】:error No resource found that matches the given name Theme.AppCompat.Light.DarkActionBar. Android Studio 2.1.1 + Support library错误找不到与给定名称 Theme.AppCompat.Light.DarkActionBar 匹配的资源。 Android Studio 2.1.1 + 支持库
【发布时间】:2016-06-18 02:38:57
【问题描述】:

D:\Documents\Learn\Testing\MyApplication\app\build\intermediates\res\merged\debug\values\values.xml

错误:(7) 检索项目的父项时出错:找不到资源 匹配给定名称“Theme.AppCompat.Light.DarkActionBar”。

我安装了 Android Studio 2.1 并尝试学习 Mockito。

但是它没有创建 Mock 对象,因为它无法识别 @Mock 注释(编译错误)。

所以我安装了 Android 支持库 33.0。现在我收到错误:找不到与给定名称 Theme.AppCompat.Light.DarkActionBar 匹配的资源

我将 Android Studio 更新到 2.1.2 但没有区别。

任何帮助表示赞赏。

Information:Gradle tasks [:app:generateDebugSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar,
 :app:compileDebugUnitTestSources]


 :app:preBuild UP-TO-DATE
 :app:preDebugBuild UP-TO-DATE

 :app:checkDebugManifest

 :app:prepareDebugDependencies

 :app:compileDebugAidl UP-TO-DATE

 :app:compileDebugRenderscript UP-TO-DATE

 :app:generateDebugBuildConfig UP-TO-DATE

 :app:mergeDebugShaders UP-TO-DATE

 :app:compileDebugShaders UP-TO-DATE

 :app:generateDebugAssets UP-TO-DATE

 :app:mergeDebugAssets UP-TO-DATE

 :app:generateDebugResValues UP-TO-DATE

 :app:generateDebugResources UP-TO-DATE

 :app:mergeDebugResources UP-TO-DATE

 :app:processDebugManifest UP-TO-DATE

 :app:processDebugResources

 D:\Documents\Learn\Testing\MyApplication\app\build\intermediates\res\merged\debug\values\values.xml

 Error:(7) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

 D:\Documents\Learn\Testing\MyApplication\app\src\main\res\values\styles.xml

 Error:(4, 5) No resource found that matches the given name: attr 'colorAccent'.

 Error:(4, 5) No resource found that matches the given name: attr 'colorPrimary'.

 Error:(4, 5) No resource found that matches the given name: attr 'colorPrimaryDark'.

 Error:Execution failed for task ':app:processDebugResources'.

 > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 

 'D:\Android\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1

 Information:BUILD FAILED

 Information:Total time: 6.239 secs

 Information:5 errors

 Information:0 warnings

 Information:See complete output in console

我的 gradle 文件在这里:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "me.com.myapplication"
        minSdkVersion 22
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile 'com.android.support.test:runner:0.4'
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
}

【问题讨论】:

  • 发布你的 gradle 文件。
  • 请发布您的 gradle 文件。还可以尝试在 Android Studio 中重建您的项目。
  • 哎呀,附在这里...

标签: android android-studio mockito android-support-library android-sdk-tools


【解决方案1】:

我找到了这个post

并将清单中的主题更改为

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
</style>

解决了!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    • 2016-07-07
    • 2015-05-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多