Skip to content

[core] (1.5.0) APK fails to decompile with "Unsigned short value out of range: 71344" #2158

@bluemods

Description

@bluemods

Issue details

The new release (1.5.0) fails to decompile APKs that previously decompiled many times without issue. Attached stack trace is below.

This error is caused by the smali tool attempting to repack a folder into a DEX file that has too many classes / methods in it (limit is 65536).
This is probably caused by methods being inserted by JADX somehow into the smali then recompiling it, which then causes the per-dex limit to be exceeded. To get around this, you would split it into multiple dex files to make sure each one is under the limit.
Not sure where I would look in the source to fix that though.

APK can be downloaded at: https://www.apkmirror.com/wp-content/themes/APKMirror/download.php?id=1237973&key=b005627028a9b01020c015bd1d083505135f1d1e

Relevant log output or stacktrace

ERROR: Smali compilation error:
com.android.tools.smali.util.ExceptionWithContext: Unsigned short value out of range: 71344
	at com.android.tools.smali.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:115)
	at com.android.tools.smali.dexlib2.writer.DexWriter.writeMethods(DexWriter.java:542)
	at com.android.tools.smali.dexlib2.writer.DexWriter.writeTo(DexWriter.java:386)
	at com.android.tools.smali.dexlib2.writer.DexWriter.writeTo(DexWriter.java:370)
	at com.android.tools.smali.smali.Smali.assemble(Smali.java:136)
	at jadx.plugins.input.smali.SmaliConvert.lambda$compileSmali$1(SmaliConvert.java:60)
	at jadx.plugins.input.smali.SmaliConvert.collectSystemErrors(SmaliConvert.java:73)
	at jadx.plugins.input.smali.SmaliConvert.compileSmali(SmaliConvert.java:60)
	at jadx.plugins.input.smali.SmaliConvert.execute(SmaliConvert.java:38)
	at jadx.plugins.input.smali.SmaliInputPlugin.lambda$init$0(SmaliInputPlugin.java:22)
	at jadx.api.JadxDecompiler.loadInputFiles(JadxDecompiler.java:153)
	at jadx.api.JadxDecompiler.load(JadxDecompiler.java:119)
	at jadx.gui.JadxWrapper.open(JadxWrapper.java:72)
	at jadx.gui.ui.MainWindow.lambda$loadFiles$0(MainWindow.java:520)
	at jadx.core.utils.tasks.TaskExecutor.wrapTask(TaskExecutor.java:166)
	at jadx.core.utils.tasks.TaskExecutor.runStages(TaskExecutor.java:142)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)


ERROR: Smali compilation error:
com.android.tools.smali.util.ExceptionWithContext: Unsigned short value out of range: 71344
	at com.android.tools.smali.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:115)
	at com.android.tools.smali.dexlib2.writer.DexWriter.writeMethods(DexWriter.java:542)
	at com.android.tools.smali.dexlib2.writer.DexWriter.writeTo(DexWriter.java:386)
	at com.android.tools.smali.dexlib2.writer.DexWriter.writeTo(DexWriter.java:370)
	at com.android.tools.smali.smali.Smali.assemble(Smali.java:136)
	at jadx.plugins.input.smali.SmaliConvert.lambda$compileSmali$1(SmaliConvert.java:60)
	at jadx.plugins.input.smali.SmaliConvert.collectSystemErrors(SmaliConvert.java:73)
	at jadx.plugins.input.smali.SmaliConvert.compileSmali(SmaliConvert.java:60)
	at jadx.plugins.input.smali.SmaliConvert.execute(SmaliConvert.java:38)
	at jadx.plugins.input.smali.SmaliInputPlugin.lambda$init$0(SmaliInputPlugin.java:22)
	at jadx.api.JadxDecompiler.loadInputFiles(JadxDecompiler.java:153)
	at jadx.api.JadxDecompiler.load(JadxDecompiler.java:119)
	at jadx.gui.JadxWrapper.open(JadxWrapper.java:72)
	at jadx.gui.ui.MainWindow.lambda$loadFiles$0(MainWindow.java:520)
	at jadx.core.utils.tasks.TaskExecutor.wrapTask(TaskExecutor.java:166)
	at jadx.core.utils.tasks.TaskExecutor.runStages(TaskExecutor.java:142)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Provide sample and class/method full name

No response

Jadx version

1.5.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions