AppCompat 资源在一个特定项目中不可用

AppCompat resources not available in one specific project

我在让支持库在某个项目中工作时遇到严重问题。它已经相当大了,几个月前我从另一个开发人员那里接管了它。

问题是:我无法使用我迫切需要的任何 AppCompat 资源。我需要它们,因为我使用支持工具栏 class,它需要一个 ActionBarActivity,而 ActionBarActivity 又需要在 Theme.AppCompat.* 中使用主题,而这些仅在 appcompat.

中可用

我已经将以下几行放入我的 build.gradle 应用模块中:

compile 'com.android.support:appcompat-v7:22.2.0+'
compile 'com.android.support:support-v4:22.2.0+'

奇怪的是,在我左侧的 "Project" 视图中,库没有显示在 "External Libraries" 下。但是,如果我在 Android Studio 中创建一个新项目,我可以从一开始就访问支持库。它们出现在 "External Libraries" 下,一切正常。所以问题不可能和我的sdk安装有关。

我的app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '21.1.2'

    defaultConfig {
        applicationId 'com.example.app'
        multiDexEnabled = true
        minSdkVersion 14
        targetSdkVersion 22
    }

    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.release
            debuggable false
            jniDebuggable false
            zipAlignEnabled true
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }


    dexOptions {
        javaMaxHeapSize "4g"
    }

}

dependencies {
    compile 'com.android.support:appcompat-v7:22.2.0+'
    compile 'com.android.support:support-v4:22.2.0+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':firebase_plugin')
    compile project(':geofire')
    compile 'com.android.support:multidex:1.0.0'
    compile files('libs/acra-4.5.0.jar')
}

我的 "External Libraries" 看起来像这样:

从评论中移出:尝试将 buildToolsVersion 更改为 22.0.1。