testwhat / SmaliEx

A wrapper to get de-optimized dex from odex/oat/vdex.
529 stars 142 forks source link

Unable to get DEX from OAT of Android N image #19

Closed xsveda closed 8 years ago

xsveda commented 8 years ago

I pulled out a boot-framework.oat from emulator with Android N image adb pull system/framework/arm/boot-framework.oat

but getting DEX from it fails:

java -jar oat2dex/oat2dex.jar boot boot-framework.oat Invalid dex magic java.io.EOFException at java.io.RandomAccessFile.readInt(Unknown Source) at org.rh.smaliex.reader.DataReader.readInt(DataReader.java:87) at org.rh.smaliex.reader.Oat$DexFile$Header.(Oat.java:168) at org.rh.smaliex.reader.Oat$DexFile.(Oat.java:203) at org.rh.smaliex.reader.Oat.(Oat.java:277) at org.rh.smaliex.OatUtil.getOat(OatUtil.java:144) at org.rh.smaliex.OatUtil.extractOdexFromOat(OatUtil.java:183) at org.rh.smaliex.OatUtil.prepareOdex(OatUtil.java:123) at org.rh.smaliex.OatUtil.bootOat2Dex(OatUtil.java:112) at org.rh.smaliex.Main.mainImpl(Main.java:113) at org.rh.smaliex.Main.main(Main.java:54)

Unhandled IOException: null

Is there anything I'm mussing or is it just an unsupported OAT format in Android N?

mmhobi7 commented 8 years ago

Unsupported, I believe. I think they just moved them out of boot.oat so it should be easy, right?

xsveda commented 8 years ago

Any plan to support new OAT format in Android N? Or is it possible to get DEX any other way? I'll be grateful for any hint.

testwhat commented 8 years ago

The commit 227f79ca should be able to extract dex for android N. (Tested with emulator, only an error when deodex apache-xml.dex) I did not upload last snapshot build because N is not formal release yet. To have a try, just pull the latest code and build with command in the readme.

bursoft-git commented 8 years ago

For deodex Android N you can use my tool Batch Apktool, it uses latest oat2dex Direct download link https://yadi.sk/d/AmVk9KBNqhaPx Best Regards.

mmhobi7 commented 8 years ago

@bursoft-git Nice tool, but I do have a request I'm not sure how plugins work in your tool, so it could be something easy, but after deodexing my system apps, I find that some signatures mismatch. It could be my fault, but does the tool sign all apks regardless if they are odexed or not? and if does not, can it?

bursoft-git commented 8 years ago

@Aaahh As far as I know, in 90% of cases signing system apps is not required But if you want you can sign the necessary files manually (using the [4] option)

xsveda commented 8 years ago

@testwhat Your fix works like a charm, thanks !!!