无法在Android Studio中调用增量任务错误

时间:2013-11-28 11:13:39

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

所以我在安卓工作室整天坚持这一天。

我已尝试按照本教程添加对我的应用程序的Google Maps API的支持

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

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

Gradle:任务执行失败':dexDebug'。

  

无法在任务'上调用IncrementalTask​​.taskAction():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'

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

1 个答案:

答案 0 :(得分:1)

您是否安装了Play服务?在Android Studio中,转到SDK Manager。在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