Closed kmbisset89 closed 1 year ago
Hi, it looks like apktool
doesn't "see" all the available memory. The first thing that comes to my mind is that one could edit the /usr/local/bin/apktool
file inside the Docker image and change the line javaOpts="-Xmx512M ...
to something like javaOpts="-Xmx4G ...
(or more if needed).
I have a rather large APK (450 MB), and I am getting an OOM Exception when using it in a docker container :
Docker Command
winpty docker run -m=20g --rm -it -v "C:\dev\obfuscation":"/workdir" obfuscapk -i -p -d /c/dev/obfuscation/0.8.3-o2.apk -w dir --use-aapt2 -o Rebuild -o NewAlignment -o NewSignature 0.8.3.apk
Error Log
[ERROR][obfuscapk.tool.Apktool][build()] Error during build command: I: Using Apktool 2.7.0 I: Smaling smali folder into classes.dex... Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.base/java.lang.StringUTF16.compress(StringUTF16.java:160) at java.base/java.lang.String.(String.java:3214)
at java.base/java.lang.String.(String.java:276)
at org.jf.smali.smaliFlexLexer.yytext(smaliFlexLexer.java:3528)
at org.jf.smali.smaliFlexLexer.yylex(smaliFlexLexer.java:3896)
at org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:3198)
at org.antlr.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:143)
at org.antlr.runtime.BufferedTokenStream.sync(BufferedTokenStream.java:137)
at org.antlr.runtime.CommonTokenStream.consume(CommonTokenStream.java:68)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:106)
at org.jf.smali.smaliParser.method_prototype(smaliParser.java:4289)
at org.jf.smali.smaliParser.method_reference(smaliParser.java:7922)
at org.jf.smali.smaliParser.insn_format35c_method(smaliParser.java:14623)
at org.jf.smali.smaliParser.instruction(smaliParser.java:11208)
at org.jf.smali.smaliParser.ordered_method_item(smaliParser.java:2195)
at org.jf.smali.smaliParser.statements_and_directives(smaliParser.java:1915)
at org.jf.smali.smaliParser.method(smaliParser.java:1711)
at org.jf.smali.smaliParser.smali_file(smaliParser.java:624)
at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:63)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:71)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:437)
at brut.androlib.Androlib.buildSources(Androlib.java:368)
at brut.androlib.Androlib.build(Androlib.java:320)
at brut.androlib.Androlib.build(Androlib.java:287)
at brut.apktool.Main.cmdBuild(Main.java:263)
at brut.apktool.Main.main(Main.java:82)