Gradle没有工作android工作室

时间:2016-07-02 01:04:25

标签: android android-studio gradle android-gradle

当我尝试运行我的应用时,我一直收到此错误消息。它在告诉我

To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 989 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to   more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.

我从早上起就遇到了这个错误,我仍然无法修复它。我在网上寻找答案,我甚至尝试重新安装Android工作室,但没有任何工作。我更改了堆大小并在代码末尾添加了行,但没有任何对我有用。有人可以帮忙吗?我使用的是最新版本的AS。

1 个答案:

答案 0 :(得分:0)

我之前遇到过这个问题。尝试将它放在您的Module build.gradle:

android {   
     ...
    defaultConfig {
        // Enabling multidex support.
        multiDexEnabled true
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}


dependencies {

    ....

    compile 'com.android.support:multidex:1.0.0'
}