REAndroid / APKEditor

Powerful android apk editor - aapt/aapt2 independent
Apache License 2.0
645 stars 95 forks source link

Add option to decode only classes*.dex #98

Closed Zenlua closed 2 months ago

Zenlua commented 2 months ago

Hope there is more option to decode only dex to smali

REAndroid commented 2 months ago

Already in place, APKEditor.jar d -t raw

Run with -h to see detail help APKEditor.jar d -h

Decodes android resources binary to readable json/xml
Options:
   -i                  input path
   -o                  output path
   -framework-version  preferred framework version number
   -framework          path of framework file (can be multiple)
   -sig                signatures directory path
   -t                  Decode types: 
                        1) json 
                        2) xml 
                        3) raw 
                        4) sig 
                       default=xml
   -res-dir            sets resource files root dir name
                       (eg. for obfuscation to move files from 'res/*' to 'r/*' 
                       or vice versa)
Flags:
   -dex            Copy raw dex files / skip smali
   -f              force delete output path
   -keep-res-path  Keeps original res/* file paths:
                    *Applies only when decoding to xml
                    *All res/* files will be placed on dir <res-files>
                    *The relative paths will be linked to values/*xml
   -split-json     splits resources.arsc into multiple parts as per type entries
                   (use this for large files)
   -vrd            validate resources dir name
                   (eg. if a drawable resource file path is 'res/abc.png' then
                   it will be moved to 'res/drawable/abc.png')
Zenlua commented 2 months ago

Oh thank

Zenlua commented 2 months ago

When decoding with the raw option and recompressing, an error occurs

Zenlua commented 2 months ago

Exception in thread "main" java.lang.IllegalArgumentException: java.io.EOFException: Finished reading: 0 at com.reandroid.apk.ApkModule.getTableBlock(ApkModule.java:808) at com.reandroid.apk.ApkModule.getTableBlock(ApkModule.java:869) at com.reandroid.apk.ApkModuleEncoder.droNullTableBlock(ApkModuleEncoder.java:91) at com.reandroid.apk.ApkModuleEncoder.scanDirectory(ApkModuleEncoder.java:52) at com.reandroid.apkeditor.compile.Builder.buildRaw(Builder.java:143) at com.reandroid.apkeditor.compile.Builder.run(Builder.java:45) at com.reandroid.apkeditor.compile.Builder.execute(Builder.java:176) at com.reandroid.apkeditor.Main.execute(Main.java:85) at com.reandroid.apkeditor.Main.execute(Main.java:64) at com.reandroid.apkeditor.Main.main(Main.java:36) Caused by: java.io.EOFException: Finished reading: 0 at com.reandroid.arsc.io.BlockReader.readFully(BlockReader.java:197) at com.reandroid.arsc.io.BlockReader.readFully(BlockReader.java:181) at com.reandroid.arsc.item.BlockItem.onReadBytes(BlockItem.java:123) at com.reandroid.arsc.base.Block.readBytes(Block.java:44) at com.reandroid.arsc.base.BlockContainer.onReadBytes(BlockContainer.java:148) at com.reandroid.arsc.header.HeaderBlock.onReadBytes(HeaderBlock.java:152) at com.reandroid.arsc.base.Block.readBytes(Block.java:44) at com.reandroid.arsc.chunk.TableBlock.onReadBytes(TableBlock.java:630) at com.reandroid.arsc.base.Block.readBytes(Block.java:44) at com.reandroid.arsc.chunk.TableBlock.readBytes(TableBlock.java:664) at com.reandroid.arsc.chunk.TableBlock.load(TableBlock.java:805) at com.reandroid.apk.ApkModule.loadTableBlock(ApkModule.java:980) at com.reandroid.apk.ApkModule.getTableBlock(ApkModule.java:801) ... 9 more

REAndroid commented 2 months ago

Can't replicate this without the apk

Zenlua commented 2 months ago

All jar files in the framework suffer. ActivityExt.zip

REAndroid commented 2 months ago

I split this to #99 , closing