Apktool icon indicating copy to clipboard operation
Apktool copied to clipboard

Getters and setters for private fields/methods changed from access$ to -get / -wrap

Open jtothe4n opened this issue 8 years ago • 7 comments

I noticed that on Android N, the naming changed. Tried it on an HTC10 build and also on an CM14, both have the new naming.

Tried to compile an own apk then with SDK25 but still get the old access$ naming.

Any idea how to get the new naming to work on own compiled apks? Or is it possible to add a switch to get the old naming back?

jtothe4n avatar Oct 31 '16 07:10 jtothe4n

Don't think it's related to android sdk, LG decompiled apps have -get(), -wrap() and -set() methods since api 23.

Wondering too how that can be achieved though..

xpirt avatar Oct 31 '16 13:10 xpirt

@xpirt Do you always rename it to the new naming or use the old "access$" onces? Should still work I assume.

jtothe4n avatar Nov 01 '16 09:11 jtothe4n

I usually leave them as they are, but yes renaming them makes it more readable and they don't break anything.

xpirt avatar Nov 01 '16 10:11 xpirt

It seems that there's a new nice toolchain which generates those new getters/setters, it is called Jack.

Jack is a new Android toolchain that compiles Java source into Android dex bytecode. It replaces the previous Android toolchain, which consists of multiple tools, such as javac, ProGuard, jarjar, and dx.

https://source.android.com/source/jack.html

xpirt avatar Dec 01 '16 13:12 xpirt

yepp @JesusFreke told me that yesterday too. https://github.com/JesusFreke/smali/issues/475

jtothe4n avatar Dec 01 '16 13:12 jtothe4n

Thanks for the research on this. I'll mark as upstream since it appears this is something smali will need to patch.

iBotPeaches avatar Dec 01 '16 15:12 iBotPeaches

4+ year update. Upstream ticket is still open. Tagged as "smali"

iBotPeaches avatar Nov 29 '20 12:11 iBotPeaches

It appears after almost 8~ years. I am going to close this. The original notice was presumably because diff/changes were easy to notice as the world moved from a combination of javac/dx to jack.

Then like a few years later - AOSP realized that it was better to stay true to javac/dx to keep in line with language features and deprecated jack and went back. https://android-developers.googleblog.com/2017/03/future-of-java-8-language-feature.html

So now at this point with Google forking JesusFreke's smali which had this request in backlog as well for 8 years - it seems its safe to close this.

iBotPeaches avatar Jul 23 '23 23:07 iBotPeaches