【问题标题】:Gradle not working android studio [duplicate]Gradle不工作android工作室[重复]
【发布时间】:2016-11-04 11:07:27
【问题描述】:

当我尝试运行我的应用程序时,我不断收到此错误。它告诉我

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 studio 但没有任何效果。我更改了堆大小并在代码末尾添加了行,但对我没有任何作用。有人可以帮忙吗?我使用的是最新版本的 AS。

【问题讨论】:

  • 你在哪里添加了堆大小?
  • 请查看该问题,如果这没有帮助,请在所有错误日志中提出新问题
  • @Newbiee 试过不行
  • @Sharj 我关注了新手刚刚评论的评论中的内容
  • @ban23 # 表示这是一条评论。你必须在没有它的情况下编写它。

标签: android android-studio gradle android-gradle-plugin


【解决方案1】:

我以前遇到过这个问题。试着把它放在你的 Module build.gradle 中:

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

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}


dependencies {

    ....

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-25
    • 2018-04-03
    • 2019-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 2016-10-25
    相关资源
    最近更新 更多