解决方案:在android->sdk->build-tools-android-version 中有个 dx.bat
dx.bat --dex
命令的dx.bat脚本有这样一句代码
REM By default, give dx a max heap size of 1 gig and a stack size of 1meg. rem This can be overridden by using "-JXmx..." and "-JXss..." options below. set defaultXmx=-Xmx1024M set defaultXss=-Xss1m
set defaultXmx=-Xmx1024M
原因就是此处设置的Xmx为1024M,编译打包APK时java虚拟机内存空间不足,修改为512M即可正常编译打包了。
时间: 2024-11-05 20:49:05