Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Android Beta m5-rc14 Home can´t be decompiled. (Yes, i know, that this an very, very old Android version, but maybe it can be fixed) #3311

Closed
user0-07161 opened this issue Sep 3, 2023 · 12 comments · Fixed by #3325

Comments

@user0-07161
Copy link

user0-07161 commented Sep 3, 2023

Information

  1. Apktool Version (apktool -version) - 2.8.1
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - ROM
  4. Java Version (java --version) - java version "1.8.0_381" Java(TM) SE Runtime Environment (build 1.8.0_381-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode)
  5. If you don´t know what Android Beta m5-rc14 is, here is the SDK with the Emulator, and here is the BetaWiki.

Stacktrace/Logcat

I: Using Apktool 2.8.1 on Home.apk
I: Loading resource table...
Exception in thread "main" java.lang.NullPointerException
        at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:351)
        at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:318)
        at brut.androlib.res.decoder.ARSCDecoder.readResourceTable(ARSCDecoder.java:99)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:50)
        at brut.androlib.res.data.ResTable.loadResPackagesFromApk(ResTable.java:176)
        at brut.androlib.res.data.ResTable.loadMainPkg(ResTable.java:126)
        at brut.androlib.res.ResourcesDecoder.getResTable(ResourcesDecoder.java:88)
        at brut.androlib.res.ResourcesDecoder.decodeManifest(ResourcesDecoder.java:106)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:95)
        at brut.apktool.Main.cmdDecode(Main.java:190)
        at brut.apktool.Main.main(Main.java:93)

Steps to Reproduce

  1. apktool d Home.apk

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)
Android Beta m3 framework-res.apk(doesn't changed anything to M5)

APK

If this APK can be freely shared, please upload/attach a link to it.
Home.apk

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? - No, because it can´t decompile
  2. If you are trying to install a modified apk, did you resign it? - I don´t can install it, because i can´t decompile it.
  3. Are you using the latest apktool version? - Yes
@iBotPeaches
Copy link
Owner

Yeah doesn't work on latest. I'll take a look when I'm back in the zone of disassembly errors and take another look.

@user0-07161
Copy link
Author

Thanks

@user0-07161
Copy link
Author

The same with all Apks from Android Beta m5-rc-14. All available at https://github.com/user0-tb/ApktoolDebug

@user0-07161
Copy link
Author

Is it fixable?

@iBotPeaches
Copy link
Owner

Sorry I don't tend to like mixing working on issues recently. I've found it more helpful for me to stay focused on an a single issue on the way towards resolution. Once I'm complete with my latest ticket (#2836) - I'll revisit open tickets.

So I don't have an answer yet.

@user0-07161
Copy link
Author

user0-07161 commented Sep 6, 2023

If you need any Files or Source Code, ask me, before closing issue, because I have some Source Code of Android Beta M5 and M3.

@iBotPeaches
Copy link
Owner

I took a look - this is because we either regressed or the packing order of chunks was different back then.

F: Chunk #1 start: type=0x0002 chunkSize=0x0002c8fc
F: Chunk #2 start: type=0x0001 chunkSize=0x00010f84
F: Chunk #3 start: type=0x0200 chunkSize=0x0001b96c
F: Chunk #4 start: type=0x0201 chunkSize=0x00003b80

What I tend to normally expect

F: Chunk #1 start: type=0x0002 chunkSize=0x0010ca40
F: Chunk #2 start: type=0x0001 chunkSize=0x0007132c
F: Chunk #3 start: type=0x0200 chunkSize=0x0009b708
F: Chunk #4 start: type=0x0202 chunkSize=0x00000060

We are basically reading types without specs so lots of NPEs on that path. Probably fixable if we change up our type loading to be more deferred.

@iBotPeaches
Copy link
Owner

This looks to be a never ending journey of patches. I'm going to toss in backlog @user0-tb.

If you have source of the framework-res or ResourceTypes.h - I can revisit.

@user0-07161
Copy link
Author

Here @iBotPeaches
Framework-res:
framework-res_src.zip

@iBotPeaches
Copy link
Owner

@user0-tb - This doesn't look like the source of the application, just the source (java) portion.

@iBotPeaches
Copy link
Owner

I've decided after peeking a bit more - that there is real no chance of this older M builds working on compilation. The build tools of this era will generate a resource table that Milestone builds from '08 have zero chance of understanding.

So I'll merge a PR that at least fixes disassembly, but not going to have any chance of compilation. This seems like a happy medium for how old this is.

Ticket will close on merge of PR.

iBotPeaches added a commit that referenced this issue Sep 11, 2023
@user0-07161
Copy link
Author

It´s working now! Thanks @iBotPeaches!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants