admin管理员组

文章数量:1531934

在win上打包可能会遇到这样的错误

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 33280 MB (based on the dexOptions.javaMaxHeapSize = 32g).
To do this set org.gradle.jvmargs=-Xmx33280M in the project gradle.properties.
For more information see https://docs.gradle/current/userguide/build_environment.html

:org.vortexcannon.LastMan:mergeDebugJniLibFolders
:org.vortexcannon.LastMan:transformNative_libsWithMergeJniLibsForDebug
:org.vortexcannon.LastMan:processDebugJavaRes UP-TO-DATE
:org.vortexcannon.LastMan:transformResourcesWithMergeJavaResForDebug
:org.vortexcannon.LastMan:validateSigningDebug
:org.vortexcannon.LastMan:packageDebug
Expiring Daemon because JVM Tenured space is exhausted
Daemon will be stopped at the end of the build after running out of JVM memory
Exception in thread "pool-7-thread-1" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:3236)
    at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
    at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
    at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
    at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
    at com.android.builder.internal.packaging.zippress.DeflateExecutionCompressor.immediateCompress(DeflateExecutionCompressor.java:70)
    at com.android.builder.internal.packaging.zippress.ExecutorCompressor.lambda$compress$0(ExecutorCompressor.java:55)
    at com.android.builder.internal.packaging.zippress.ExecutorCompressor$$Lambda$225/575637572.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-7-thread-2" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:3236)
    at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
    at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
    at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
    at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
    at com.android.builder.internal.packaging.zippress.DeflateExecutionCompressor.immediateCompress(DeflateExecutionCompressor.java:70)
    at com.android.builder.internal.packaging.zippress.ExecutorCompressor.lambda$compress$0(ExecutorCompressor.java:55)
    at com.android.builder.internal.packaging.zippress.ExecutorCompressor$$Lambda$225/575637572.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-7-thread-3" java.lang.OutOfMemoryError: Java heap space
Exception in thread "pool-7-thread-4" java.lang.OutOfMemoryError: Java heap space
Exception in thread "pool-7-thread-5" java.lang.OutOfMemoryError: Java heap space
Exception in thread "pool-7-thread-6" java.lang.OutOfMemoryError: Java heap space
Exception in thread "pool-7-thread-7" java.lang.OutOfMemoryError: Java heap space
Exception in thread "pool-7-thread-8" java.lang.OutOfMemoryError: Java heap space
Exception in thread "pool-7-thread-9" java.lang.OutOfMemoryError: Java heap space
Expiring Daemon because JVM Tenured space is exhausted
Exception in thread "pool-7-thread-10" java.lang.OutOfMemoryError: Java heap space
Daemon is stopping immediately JVM garbage collector thrashing and after running out of JVM memory

FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon has been stopped: JVM garbage collector thrashing and after running out of JVM memory

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


C:\Windows\system32\cmd.exe DONE (1)
C:\Windows\system32\subst.exe /d Z:


C:\Windows\system32\subst.exe DONE (0)
System.Exception: Build Failed
   в ..(Dictionary`2 , String , String , Boolean )
   в Igor.AndroidBuilder.Package()Igor complete.
elapsed time 00:05:11.2807770s for command "C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.0.6.93/bin/Igor.exe" -options="C:\Users\Vortex\AppData\Local\GameMakerStudio2\build.bff"  -- Android Package started at 05/10/2017 10:53:24
FAILED : Package Program Complete

解决方案:

在路径Copied it to C:\Users\***\.gradle下面创建一个gradle.properties文件,在其中写入

org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx12800M
org.gradle.configureondemand=true

 

这个错误的大致原因就是打大型apk包时会出现jvm空间不够的情况,小包情况下不会出现。

本文标签: 方式UnityGradle