suficiente restaurar que para operación memoria insuficiente funcionen error equipo completar chrome anterior java android android-studio

restaurar - Error de memoria insuficiente: memoria del montón de Java en Android Studio



memoria insuficiente windows 10 (7)

¿Cómo soluciono java.lang.OutOfMemoryError: Java heap space al compilar mi proyecto de Android?

Obtengo esto después de actualizar a la versión 1 de Android Studio. Pero, no creo que este sea el problema. Lo más probable es que cuando comience a actualizar mi aplicación a SDK 21 (antes era SDK 20). Pero tampoco estaba tan seguro.

He buscado en Google por some fix , pero no pude encontrar uno que funcione. La mayoría de las correcciones son para Eclipse IDE.

Este es el error logcat completo que obtengo al compilar:

warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.unzip.Unzip$1) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.unzip.Unzip$2) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.util.ArchiveMaintainer$1) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.util.ArchiveMaintainer$2) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.zip.ZipEngine$1) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space at com.android.dx.rop.code.RegisterSpec$ForComparison.toRegisterSpec(RegisterSpec.java:642) at com.android.dx.rop.code.RegisterSpec.intern(RegisterSpec.java:73) at com.android.dx.rop.code.RegisterSpec.make(RegisterSpec.java:90) at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:323) at com.android.dx.cf.code.Simulator$SimVisitor.visitLocal(Simulator.java:612) at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:412) at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94) at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:787) at com.android.dx.cf.code.Ropper.doit(Ropper.java:742) at com.android.dx.cf.code.Ropper.convert(Ropper.java:349) at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280) at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137) at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93) at com.android.dx.command.dexer.Main.processClass(Main.java:729) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673) at com.android.dx.command.dexer.Main.access$300(Main.java:82) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:632) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:505) at com.android.dx.command.dexer.Main.runMultiDex(Main.java:332) at com.android.dx.command.dexer.Main.run(Main.java:243) at com.android.dx.command.dexer.Main.main(Main.java:214) at com.android.dx.command.Main.main(Main.java:106) FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task '':app:dexDebug''. > com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:/Users/piracyde25/android-sdks/build-tools/21.1.1/dx.bat --dex --no-optimize --multi-dex --main-dex-list C:/Users/piracyde25/workspace/Baucar/app/build/intermediates/multi-dex/debug/maindexlist.txt --output C:/Users/piracyde25/workspace/Baucar/app/build/intermediates/dex/debug --input-list=C:/Users/piracyde25/workspace/Baucar/app/build/intermediates/tmp/dex/debug/inputList.txt Error Code: 3 Output: warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.unzip.Unzip$1) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.unzip.Unzip$2) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.util.ArchiveMaintainer$1) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.util.ArchiveMaintainer$2) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (net.lingala.zip4j.zip.ZipEngine$1) that doesn''t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space at com.android.dx.rop.code.RegisterSpec$ForComparison.toRegisterSpec(RegisterSpec.java:642) at com.android.dx.rop.code.RegisterSpec.intern(RegisterSpec.java:73) at com.android.dx.rop.code.RegisterSpec.make(RegisterSpec.java:90) at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:323) at com.android.dx.cf.code.Simulator$SimVisitor.visitLocal(Simulator.java:612) at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:412) at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94) at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:787) at com.android.dx.cf.code.Ropper.doit(Ropper.java:742) at com.android.dx.cf.code.Ropper.convert(Ropper.java:349) at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280) at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137) at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93) at com.android.dx.command.dexer.Main.processClass(Main.java:729) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673) at com.android.dx.command.dexer.Main.access$300(Main.java:82) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:632) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:505) at com.android.dx.command.dexer.Main.runMultiDex(Main.java:332) at com.android.dx.command.dexer.Main.run(Main.java:243) at com.android.dx.command.dexer.Main.main(Main.java:214) at com.android.dx.command.Main.main(Main.java:106)

¿Es debido a una biblioteca jar que usé (zip4j)? Intenté eliminarlo, pero el error de OOM sigue ocurriendo. ¿Algúna idea de cómo arreglar esto?

Editar:

También he editado el archivo gradlew para aumentar el tamaño de -Xmx.

GRADLE_OPTS="$GRADLE_OPTS /"-Xdock:name=$APP_NAME/" /"-Xdock:icon=$APP_HOME/media/gradle.icns/" /"-Xmx2048M /"-XX:MaxPermSize=512M/" /"-XX:ReservedCodeCacheSize=512M/""

Nada cambia.

Edición 2:

También hice this corrección pero no pude evitarlo también:

Intenta lo siguiente:

Ctrl + Alt + S -> Compilador -> Gradle

En el campo VM Options escribe:

-Xmx2048m -XX: MaxPermSize = 512m


Esto es antiguo, pero solo agrega esto al archivo de compilación

dexOptions { javaMaxHeapSize "2g" }


Estoy usando el sistema operativo Windows. Resolví esto actualizando _JAVA_OPTIONS a ''-Xmx1024m''

  1. Win + X, elige SISTEMA
  2. Elija ''Configuración avanzada del sistema''
  3. Elija ''Variables de entorno''
  4. Crear / Editar una variable llamada ''_JAVA_OPTIONS''
  5. actualizar el valor de la variable como -Xmx1024m

haga clic para ver la instantánea


Finalmente lo resolví limitando el servicio Google Play en la dependencia de Gradle.

Sin embargo, el problema fue causado por el servicio Google Play, y simplemente cambiándolo a una biblioteca específica, ahora está resuelto.

com.google.android.gms:play-services-base:6.5.87

ACTUALIZAR

Más información sobre las guías de Android.


Las respuestas anteriores son para compilaciones de Gradle (o el general -Xmx). En caso de que alguien llegue aquí para un proyecto que no sea de gradle, resolví el problema aumentando el tamaño máximo de DEX en la configuración de Android Studio => Build, Execution, Deployment => Compiler => Android Compilers


Tuve un problema similar en Android Studio 2.3.3. El empaquetado de APK fallaría diciendo que el Java heap space al construir desde Android Studio y tratar de procesar una biblioteca .so de 300MB. En mi caso se necesitaron dos cosas para arreglarlo. Tu build.gradle debería contener algo así:

android { dexOptions { javaMaxHeapSize "4G" } }

En la raíz de su proyecto, necesita tener un archivo llamado gradle.properties contenga lo siguiente:

# That''s needed for java to be able the create the APK with our 300MB native library # Basically we grant java a 4GB heap. org.gradle.jvmargs=-Xmx4608m


asigne más memoria a Gradle en el archivo gradle.properties del proyecto. Por ejemplo:

org.gradle.jvmargs = -Xmx1024m


ha cambiado los argumentos incorrectos, debe aumentar el tamaño en -XX: MaxPermSize = 512M a -XX: MaxPermSize = 2048M o algo así :) porque el emulador de Android usa una gran cantidad de RAM.