error找不到与给定名称Theme.AppCompat.Light.DarkActionBar匹配的资源。 Android Studio 2.1.1 +支持库

时间:2016-06-18 02:38:57

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

  

d:\文件\了解\测试\ MyApplication的\应用\构建\中间体\ RES \合并\调试\值\ 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'
}

1 个答案:

答案 0 :(得分:0)

我发现了post

并将清单中的主题更改为

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

修复了它!