Konloch / Konloch/bytecode-viewer

Decompiling Android APK fails in 2.10.12

Open
#309 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Android Bug
Dominant language
Java
Stars
15.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I get the following error when trying to decompile an APK:

Bytecode Viewer Version: 2.10.12, Preview Copy: false, Fat Jar: true, OS: Linux, Java: 11.0.11

brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203
	at brut.androlib.res.decoder.ARSCDecoder.checkChunkType(ARSCDecoder.java:544)
	at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:88)
	at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:82)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
	at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:790)
	at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:67)
	at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:59)
	at brut.androlib.Androlib.getResTable(Androlib.java:66)
	at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:236)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:118)
	at brut.apktool.Main.cmdDecode(Main.java:179)
	at brut.apktool.Main.main(Main.java:82)
	at the.bytecode.club.bytecodeviewer.util.APKTool.decodeResources(APKTool.java:39)
	at the.bytecode.club.bytecodeviewer.resources.importing.impl.APKResourceImporter.open(APKResourceImporter.java:36)
	at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:78)
	at java.base/java.lang.Thread.run(Thread.java:829)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at APKResourceImporter.java:36 and follow the resource-decoding path in the stack trace through ApkDecoder and ARSCDecoder. Reproduce the failure with the affected APK, then determine why its resource table produces chunk type 0x00000203 instead of 0x00000200. Done means the APK decompiles without this exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.