Rebuild error
See original GitHub issuePrerequisites
- Installed the tool in a way described in the readme and ran
python3 -m obfuscapk.cli --help
without any errors - Ran the tool using only
Rebuild
,NewSignature
andNewAlignment
obfuscators to verify that the app is not using anti-repackaging techniques - Ran the tool using
--ignore-libs
to exclude third-party libraries from the obfuscation - Checked that the issue isnβt already filed: https://github.com/issues?utf8=β&q=is%3Aissue+repo%3AClaudiuGeorgiu/Obfuscapk
Description
Before opening this issue, I tried the following steps: We have tried many obfuscate options but all failed on similar error βUnsigned short value out of range: 65548β
Steps to Reproduce
Expected behavior:
As expected, βClassRenameβ option only rename class name.
Actual behavior:
But somehow, It has added more methods to dex file.
if applicable, paste here the complete error message
[(venv) ThanhNgenMacPro:src thanhnguyen.truong$ python3.7 -m obfuscapk.cli -i -p -o ClassRename -o Rebuild uat-release-noObfuscate.apk Class name to smali file mapping: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|[01:24<00:00, 541.59file/s] Renaming class declarations: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|[03:50<00:00, 198.40file/s] Renaming class usages in smali files: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|[03:59<00:00, 190.73file/s] Renaming class usages in xml files: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|[03:44<00:00, 7.66file/s] 10/04/2020 17:17:32> [ERROR][yapsy_loaded_plugin_ClassRename_1.class_rename.ClassRename][obfuscate()] remain "[53548, 49759, 11340, 2297, -1275, 4169, 34762, 53573]"ββββββββββββββββββββββββββββββββββββββββββββββ|[03:44<00:00, 10.20file/s] Running obfuscators (Rebuild): 50%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |[16:48<16:48, 1008.00s/obfuscator]10/04/2020 17:21:53> [ERROR][obfuscapk.tool.Apktool][build()] Error during build command: I: Using Apktool 2.4.1 I: Smaling smali folder into classes.dexβ¦ I: Smaling smali_classes7 folder into classes7.dexβ¦ I: Smaling smali_classes6 folder into classes6.dexβ¦ I: Smaling smali_classes8 folder into classes8.dexβ¦ I: Smaling smali_classes3 folder into classes3.dexβ¦ I: Smaling smali_classes4 folder into classes4.dexβ¦ I: Smaling smali_classes5 folder into classes5.dexβ¦ I: Smaling smali_classes2 folder into classes2.dexβ¦ Exception in thread βmainβ org.jf.util.ExceptionWithContext: Exception occurred while writing code_item for method Lcom/google/android/gms/internal/vision/zzjq;->zzhs()Lcom/google/android/gms/internal/vision/zzjq; at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:917) at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:341) at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:297) at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:61) at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:36) at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:418) at brut.androlib.Androlib.buildNonDefaultSources(Androlib.java:364) at brut.androlib.Androlib.build(Androlib.java:302) at brut.androlib.Androlib.build(Androlib.java:268) at brut.apktool.Main.cmdBuild(Main.java:251) at brut.apktool.Main.main(Main.java:79) Caused by: org.jf.util.ExceptionWithContext: Error while writing instruction at code offset 0x6c at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1190) at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:913) β¦ 10 more Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65548 at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116) at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:356) at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1150) β¦ 11 more ]
Versions
- Installation mode (e.g., from source or with Docker): source
- Obufscapk version (e.g., commit 0676488): lastest version
- OS (e.g., Ubuntu 16.04): MacOS 10.14.6
- Python version (e.g., Python 3.7.4): 3.7.4
Additional Information
Apk file(s):
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Experiencing same issue
Hi guys, Iβm having the same problem.
The tool is excellent, most commands work correctly. The apk is crashing when using βClassRenameβ. Maybe the mapping of the renamed classes is not being done correctly. Has anyone made the apk work with this command?