gpt4 book ai didi

android - 要在进程中运行 dex,Gradle 守护进程需要更大的堆。它目前大约有 3641 MB

转载 作者:太空狗 更新时间:2023-10-29 14:48:19 25 4
gpt4 key购买 nike

它在 5.0 以上的设备上工作正常。除了multidex 支持之外,这个问题还有什么解决方案吗?

详细信息:

To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 3641 MB.

For faster builds, increase the maximum heap size for the Gradle daemon to more than 4096 MB.
To do this set org.gradle.jvmargs=-Xmx4096M in the project gradle.properties.

For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.>
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command '/usr/local/jdk1.7.0_71/bin/java'' finished with non-zero exit value 2

我尝试了以下解决方案。错误仍然没有消失。

渐变

buildTypes {

debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}
}
dexOptions {
preDexLibraries true
javaMaxHeapSize "3g"
incremental true
dexInProcess = true
}

梯度属性

     org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m

最佳答案

有一个很棒的官员article关于 64k 的限制。您基本上有多种选择:

  • 检查依赖项并删除那些不需要的或可以用较小的依赖项替换的
  • 配置 ProGuard 以删除未使用的代码
  • 在您的应用中实现 MultiDex

关于“Gradle daemon needs a large heap”,这不是问题,而是一个优化提示。

关于android - 要在进程中运行 dex,Gradle 守护进程需要更大的堆。它目前大约有 3641 MB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37585264/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com