更新com.android.tools.build:gradle至2.3.0-beta1后无法解析symbol-Theme.AppCompat

更新com.android.tools.build:gradle至2.3.0-beta1后无法解析symbol-Theme.AppCompat,android,build.gradle,android-appcompat,Android,Build.gradle,Android Appcompat,在将com.android.tools.build:gradle从project升级到2.3.0-beta1之后,我遇到了这个问题。 如果我回到2.2.3,则主题.AppCompat样式可以识别 我不想将其设置为2.2.3,因为项目不会超时 以下是错误的打印: 我的项目的build.gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.

在将
com.android.tools.build:gradle
从project升级到2.3.0-beta1之后,我遇到了这个问题。 如果我回到2.2.3,则
主题.AppCompat
样式可以识别

我不想将其设置为2.2.3,因为项目不会超时

以下是错误的打印:

我的项目的
build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0-beta1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.xxxxxxx.xxxxxxx"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 76
        versionName "1.18.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    useLibrary 'org.apache.http.legacy'
}

buildscript {

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }

    repositories {

        maven {
            url 'https://maven.fabric.io/public'
        }

    }

}

repositories {

    maven {
        url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
    }

    maven {
        url 'https://maven.fabric.io/public'
    }

    flatDir {
        dirs 'libs'
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    compile(name: 'libctfclient-sdk', ext: 'aar')

    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:support-v13:25.1.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.android.support:design:25.1.0'

    compile 'com.github.gabrielemariotti.cards:library:1.8.0'
    compile 'com.github.gabrielemariotti.cards:library-extra:1.8.0'
    compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:0.9.9'
    compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
    compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'
    compile 'com.google.zxing:core:3.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.google.android.gms:play-services-analytics:9.8.0'
    compile 'com.github.nkzawa:socket.io-client:0.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
}
我的应用程序的
build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0-beta1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.xxxxxxx.xxxxxxx"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 76
        versionName "1.18.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    useLibrary 'org.apache.http.legacy'
}

buildscript {

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }

    repositories {

        maven {
            url 'https://maven.fabric.io/public'
        }

    }

}

repositories {

    maven {
        url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
    }

    maven {
        url 'https://maven.fabric.io/public'
    }

    flatDir {
        dirs 'libs'
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    compile(name: 'libctfclient-sdk', ext: 'aar')

    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:support-v13:25.1.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.android.support:design:25.1.0'

    compile 'com.github.gabrielemariotti.cards:library:1.8.0'
    compile 'com.github.gabrielemariotti.cards:library-extra:1.8.0'
    compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:0.9.9'
    compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
    compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'
    compile 'com.google.zxing:core:3.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.google.android.gms:play-services-analytics:9.8.0'
    compile 'com.github.nkzawa:socket.io-client:0.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
}
根据该错误的顺序,我有以下问题:

我已经试过了:

  • 使缓存无效\Restart

  • 将android支持库更新至最新版本

  • 清理和重建项目

有人知道如何在不将project的build.gradle设置为2.2.3的情况下解决此问题吗?

尝试:File->“使现金无效\Restart”

可能只是android studio的问题

尝试:文件->“无效现金\重新启动”


可能只是android studio的问题

我使用了android.tools.build:gradle:2.3.0-beta3,也有同样的问题。我已将Android Studio 2.2.3升级到2.3 beta 2,一切正常。

我使用了Android.tools.build:gradle:2.3.0-beta3,遇到了同样的问题。我已经将Android Studio 2.2.3升级到2.3 beta 2,一切都正常了。

正如我在回答中所说

自2.3.0版开始,在构建Android插件中默认启用“构建缓存”。它在项目文件夹外的生成缓存中创建文件(例如在\Users\%username%.android\build缓存中)。这些文件在项目之间是通用的

然后Android Studio无法在这些文件中导航

可以在gradle.properties文件中禁用生成缓存。只需添加android.enableBuildCache=false

,如回答中所述

自2.3.0版开始,在构建Android插件中默认启用“构建缓存”。它在项目文件夹外的生成缓存中创建文件(例如在\Users\%username%.android\build缓存中)。这些文件在项目之间是通用的

然后Android Studio无法在这些文件中导航


可以在gradle.properties文件中禁用生成缓存。只需添加android即可。enableBuildCache=false

文件->无效缓存/重新启动无法解决问题

Preferences->Build,Execution,Deployment->Gradle显示使用Gradle home:/Applications/Android Studio.app/Contents/Gradle/Gradle-2.14.1选择的本地Gradle发行版,并显示一条警告,指出Gradle位置不正确

通过选择“使用默认渐变包装器”(推荐)解决了此问题。
可能仅仅指向新的本地分发位置也会起作用。

文件->无效缓存/重新启动无法解决问题

Preferences->Build,Execution,Deployment->Gradle显示使用Gradle home:/Applications/Android Studio.app/Contents/Gradle/Gradle-2.14.1选择的本地Gradle发行版,并显示一条警告,指出Gradle位置不正确

通过选择“使用默认渐变包装器”(推荐)解决了此问题。
可能仅仅指向新的本地分发位置也会起作用。

我已经这样做了,但没有成功。我将把它添加到问题中,我忘了您是否试图从项目目录中删除.gradle?两天我的项目是这样的:无法解析getResources()方法。搬走了gradle之后一切都好了我还没有。我试试看。谢谢我已经做了,但没有成功。我将把它添加到问题中,我忘了您是否试图从项目目录中删除.gradle?两天我的项目是这样的:无法解析getResources()方法。搬走了gradle之后一切都好了我还没有。我试试看。谢谢