android - Could not call incremental task 错误在Android Studio中

标签 android gradle android-studio google-maps-api-2

所以我整天都在 android studio 上纠结于此。

我已尝试按照本教程为我的应用程序添加对 google maps API 的支持

https://developers.google.com/maps/documentation/android/start#install_the_android_sdk

但是当我尝试构建应用程序时出现此错误

Gradle:任务“:dexDebug”执行失败。

Could not call IncrementalTask.taskAction() on task ':dexDebug'

这是我的build.gradel

  buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'


    }
}
apply plugin: 'android'

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.google.android.gms:play-services:4.0.30'
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {
    compileSdkVersion 16
    buildToolsVersion "18.1.1"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

当我删除删除此行以进行测试时,不会出现上述错误。

    compile 'com.google.android.gms:play-services:4.0.30'

有谁知道错误代码是什么?

最佳答案

您是否安装了 Play 服务?在 Android Studio 中,转到 SDK 管理器。在 Extras 下,确保您拥有最新版本的 Google Play 服务。安装后,您可能需要重新启动 Android Studio。

要仔细检查 4.0.30 是否已下载,您可以检查 Android Studio 的本地 Maven 存储库是否包含该文件夹。路径类似于:

/Applications/Android Studio.app/sdk/extras/google/m2repository/com/google/android/gms/4.0.30

关于android - Could not call incremental task 错误在Android Studio中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20264638/

相关文章:

testing - 过滤 junit 测试套件时未找到测试

android - 滑动时 ViewPager 太慢(使用 Picasso)

android-studio - 在 Android Studio 中计算 CMake 服务器结果时出错

android - 按下后退按钮时显示两次对话框

android - 刷新 Activity

在多模块项目中使用 Gradle 的 Android AspectJ

gradle - Gradle 构建脚本在语法上是否有效 Groovy?

android - 如何在 Android Studio 4.0 中禁用 Instant Run?

android - 如何从build.gradle根文件向Android Gradle子项目添加javadoc任务?

java - Android:四向导航