Missing inner classes attribute in class files

287 views
Skip to first unread message

b...@safedk.com

unread,
Apr 13, 2015, 9:40:13 PM4/13/15
to dex...@googlegroups.com
Hi guys,

I'm decompiling an app using dex2jar, for example(angry birds).
(Can be downloaded from here: https://drive.google.com/file/d/0Bx8ZvEfEm6U4TE52eWkwZ0d3R3c/view?usp=sharing)

I noticed some class files are corrupted.
They're missing the innerClasses attribute in the byte code (https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.6).

If you decompile the linked apk, you can see that the class file: com/facebook/widget/PickerFragment.class
is missing the attribute, although it has many inner/anonymous classes(for example PickerFragment$1.class etc).

Any ideas?

Tnx,
Ben

Bob Pan

unread,
Apr 13, 2015, 10:31:32 PM4/13/15
to dex...@googlegroups.com

I believe the innerClasses is stripped by Proguard during the building process of APK.

The innerClasses is only a relationship, it is simple to recover.
1. if class names are not obfuscated, the name of inner class is separated by the '$' of its outter class. but in most cases, the names are also stripped by Proguard.
2. The fist argument of a innerClass constructor is its outter class
3. Inner class can call private method of outter class in java syntax, and a SYNTHETIC flagged method is generated for bridge the invocation.


BTW, have try the fernflower decompiler, the one integrated in Intellij IDEA. In my memory it has a better support for innerClasses.



--
You received this message because you are subscribed to the Google Groups "dex2jar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dex2jar+u...@googlegroups.com.
To post to this group, send email to dex...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

b...@safedk.com

unread,
Apr 14, 2015, 10:20:01 PM4/14/15
to dex...@googlegroups.com
Hi Bob.

I might be missing something here, but even if proguard won't strip this attribute, there is no such attribute in dalvik byte code/dex, so what difference does it make for dex2jar?

Just to clarify some apks I decompile does have this attribute in the resulting jar.

Thanks!

Bob Pan

unread,
Apr 14, 2015, 10:47:18 PM4/14/15
to dex...@googlegroups.com, b...@safedk.com

you can find the dex format document here http://source.android.com/devices/tech/dalvik/dex-format.html
the Inner class attribute is replaced by annotations named dalvik.annotation.EnclosingClass , dalvik.annotation.EnclosingMethod
dalvik.annotation.InnerClass and dalvik.annotation.MemberClasses in dex file

dex2jar will translate annotations in dex to innerclass attribute in .class file

b...@safedk.com

unread,
Apr 15, 2015, 10:43:19 PM4/15/15
to dex...@googlegroups.com, b...@safedk.com
On Wednesday, April 15, 2015 at 5:47:18 AM UTC+3, Bob Pan wrote:
> you can find the dex format document here http://source.android.com/devices/tech/dalvik/dex-format.html
> the Inner class attribute is replaced by annotations named dalvik.annotation.EnclosingClass , dalvik.annotation.EnclosingMethoddalvik.annotation.InnerClass and dalvik.annotation.MemberClasses in dex file
Thank you Bob!
Very helpful
Reply all
Reply to author
Forward
0 new messages