在使用 dexer 时处理 OOM 错误:
在构建过程中使用了一个 dx 脚本,它为 dexer 设置了默认堆大小。该脚本位于此处:
$ANDROID_SDK/build-tools/dx(或 dx.bat 取决于操作系统)。
那里有一个部分看起来像这样:
# By default, give dx a max heap size of 1 gig. This can be overridden
# by using a "-J" option (see below).
defaultMx="-Xmx1024M"
# The following will extract any initial parameters of the form
# "-J<stuff>" from the command line and pass them to the Java
# invocation (instead of to dx). This makes it possible for you to add
# a command-line parameter such as "-JXmx256M" in your scripts, for
# example. "java" (with no args) and "java -X" give a summary of
# available options.
javaOpts=""
也许尝试将 javaOpts 更改为 -Xmx2048M 或类似的东西。