ArrayIndexOutOfBoundsException when trying to export

Author: joshterrillCreated Nov 4, 2022Updated Nov 7, 2022

I've started ClassyShark using the command referenced in the README file, and in the left-hand tree, I'll click on a folder or file, then click the export button, and I get this error:

java.lang.ArrayIndexOutOfBoundsException: 6392800
	at org.ow2.asmdex.lowLevelUtils.DexFileReader.getStringItemFromStringIndex(DexFileReader.java:104)
	at org.ow2.asmdex.ApplicationReader.readAnnotationElement(ApplicationReader.java:1493)
	at org.ow2.asmdex.ApplicationReader.readEncodedAnnotation(ApplicationReader.java:1518)
	at org.ow2.asmdex.ApplicationReader.readEncodedValue(ApplicationReader.java:861)
	at org.ow2.asmdex.ApplicationReader.readAnnotationElement(ApplicationReader.java:1494)
	at org.ow2.asmdex.ApplicationReader.parseSpecificAnnotations(ApplicationReader.java:1473)
	at org.ow2.asmdex.ApplicationReader.readDefaultAnnotations(ApplicationReader.java:1271)
	at org.ow2.asmdex.ApplicationReader.visitClass(ApplicationReader.java:561)
	at org.ow2.asmdex.ApplicationReader.accept(ApplicationReader.java:437)
	at org.ow2.asmdex.ApplicationReader.accept(ApplicationReader.java:338)
	at com.google.classyshark.silverghost.translator.dex.DexMethodsDumper.fillAnalysis(DexMethodsDumper.java:106)
	at com.google.classyshark.silverghost.translator.dex.DexMethodsDumper.dumpMethods(DexMethodsDumper.java:84)
	at com.google.classyshark.silverghost.exporter.Exporter.writeMethods(Exporter.java:89)
	at com.google.classyshark.silverghost.exporter.Exporter.writeArchive(Exporter.java:47)
	at com.google.classyshark.gui.panel.ClassySharkPanel$3.doInBackground(ClassySharkPanel.java:207)
	at com.google.classyshark.gui.panel.ClassySharkPanel$3.doInBackground(ClassySharkPanel.java:202)
	at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at javax.swing.SwingWorker.run(SwingWorker.java:334)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Based on the stacktrace, it looks like the error is occurring somewhere around here: https://github.com/google/android-classyshark/blob/9c61d6df79c971a0b6c83795e7a91f2a375585cf/ClassySharkWS/src/com/google/classyshark/silverghost/translator/dex/DexMethodsDumper.java#L84

Source: google/android-classyshark