Closed robertsmd closed 3 years ago
Interesting. It sounds like the hiddenapi section has an undocumented alignment requirement.
Interesting. It sounds like the hiddenapi section has an undocumented alignment requirement.
Might be a hint here: https://android.googlesource.com/platform/art/+/master/tools/hiddenapi/hiddenapi.cc#621
@JesusFreke looks like I'll need your help here. Adding getItemAlignment()
(returning 4 for uint_32) to the class HiddenApiClassDataItem
didn't work the trick for me.
@Lanchon @iBotPeaches any help here would be appreciated so we can fix this, since you all have more experience with the dex format.
Adding line offsetWriter.align();
just before this line fixes the error above, but results in additional errors when verifying:
dexdump E 05-12 22:59:12 80234 5118856 dexdump.cc:1884] Failure to verify dex file 'classes.dex': Hiddenapi class data unexpected offset (27508 != 27506) for class def 42
appears to be an issue where the sorting isn't matching what is expected
Issue solved. writeClass
needs to be called on the classes in order sorted by key (class name), but writerestriction
(for hiddenapi restrictions) needs to be called on the classes in order sorted by the value (numerically ordered by class_idx
(more info on class_idx
can be found here. PR #816 to fix it is submitted. @JesusFreke
running the following command:
results in
or from dex2oat:
I am running on an api 29 emulator.
any help is appreciated!