MCPcopy Index your code
hub / github.com/REAndroid/APKEditor

github.com/REAndroid/APKEditor @V1.4.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release V1.4.9 ↗ · + Follow
690 symbols 1,918 edges 61 files 7 documented · 1%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

👈 Click arrows to expand/collapse details on this page

APKEditor

Powerful android apk resources editor

This tool uses ARSCLib to edit any apk resources and has six main features

java -jar APKEditor.jar -h

$ java -jar APKEditor.jar -h
APKEditor - x.x.x
https://github.com/REAndroid/APKEditor
Android binary resource files editor
Commands:
  d | decode      Decodes android resources binary to readable json/xml/raw.
  b | build       Builds android binary from json/xml/raw.
  m | merge       Merges split apk files from directory or compressed apk files
                  like XAPK, APKM, APKS ...
  x | refactor    Refactors obfuscated resource names
  p | protect     Protects/Obfuscates apk resource files. Using unique
                  obfuscation techniques.
  info            Prints information of apk.
Other options:
  -h | -help      Displays this help and exit
  -v | -version   Displays version information and exit

To get help about each command run with:
<command> -h

1- Decompile

  • Decompiles resources of apk to human readable json string.
  • Decompiles resources of apk to XML source code (for un-obfuscated apk only). Use -t xml

java -jar APKEditor.jar d -i path/to/your-file.apk

$ java -jar APKEditor.jar d -i test.apk -o test_json
00.000 I: [DECOMPILE] Using: APKEditor version 1.4.3, ARSCLib version 1.3.6
             -t = xml      
      -load-dex = 3        
       -dex-lib = jf       
             -i = test.apk 
             -o = test_json
 _________________________ 
00.006 I: [DECOMPILE] Loading ...
00.101 I: [DECOMPILE] Decompiling to xml ...
00.264 I: [DECOMPILE] Initializing android framework ...
00.264 I: [DECOMPILE] Loading android framework for version: 34
00.304 I: [DECOMPILE] Initialized framework: android-34 (14)
00.320 I: [DECOMPILE] [SANITIZE]: Sanitizing paths ...
00.341 I: [DECOMPILE] Validating resource names ...
00.396 I: [DECOMPILE] All resource names are valid
00.396 I: [DECOMPILE] Decode: archive-info.json
00.398 I: [DECOMPILE] Decode: uncompressed-files.json
00.412 I: [DECOMPILE] Decoding: AndroidManifest.xml
00.450 I: [DECOMPILE] public.xml: com.test.name -> package_1
00.508 I: [DECOMPILE] Res files: resources
02.483 I: [DECOMPILE] Baksmali: classes.dex
05.041 I: [DECOMPILE] Baksmali: classes2.dex
12.643 I: [DECOMPILE] Extracting root files ...
12.766 I: [DECOMPILE] Dumping signatures ...
12.766 I: [DECOMPILE] Saved to: test_json

more info

Decodes android resources binary to readable json/xml/raw.
Usage:
  d [Options, flags]
Options:
  -framework            Path of framework file (can be multiple).
  -framework-version    Preferred framework version number
  -i                    Input path.
  -load-dex             Number of dex files to load at a time.
                        If the apk dex files count greater than this value,
                        then the decoder loads one dex at a time.
                          *Applies only when -dex-lib set to internal.
                          *Default = 3
                          *See<Notes> below.
  -o                    Output path. Optional, if not provided then a new file
                        will be generated on same directory as input
  -remove-annotation    [Baksmali] Type name of annotation to remove from dex
                          e.g: -remove-annotation Lkotlin/Metadata;
                          *Can be multiple.
  -res-dir              Sets resource files root dir name. e.g. for obfuscation
                        to move files from 'res/*' to 'r/*' or vice versa.
  -sig                  Signatures directory path.
  -t                    Decode types:
                        [xml, json, raw, sig]
  -dex-lib              Dex library to use:
                         1) internal : Use internal library, supports dex
                        versions up to 042.
                         2) jf : Use library by JesusFreke/smali, supports dex
                        versions 035 and below.
                          *Default = internal
                          *See <Notes> below.
                        [internal, jf]
  -comment-level        [Baksmali] Sets the comment level.
                         1) off : No comment will be printed.
                         2) basic : Prints basic and resource id comments.
                         3) detail : Including <basic>, Prints class & method
                        relation comments.
                         4) detail2 : Including <detail>, Prints encoded hex
                        strings with literal as comment.
                         5) full : Prints all comments.
                         **Default = detail
                        [off, basic, detail, detail2, full]
Flags:
  -dex                  Copy raw dex files / skip smali.
  -dex-markers          Dumps dex markers (applies only when smali mode).
  -dex-profile          Decodes dex profile binary files under assets/dexopt to
                        readable json files.
  -f                    Force delete output path.
  -h | -help | --help   Displays this help and exit.
  -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
  -no-cache             Do not create dex .cache files.
  -no-dex-debug         Drops all debug info from smali/dex.
  -smali-registers      [Baksmali] Use ".registers" directive instead of the
                        default ".locals".
  -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)'
Examples:
  1)  [Basic]
  java -jar APKEditor.jar d -i path/input.apk
  2)  [Specify output]
  java -jar APKEditor.jar d -i path/input.apk -o path/output.apk
  3)  [Specify decode type]
  java -jar APKEditor.jar d -t xml -i path/input.apk
  4)  [Specify framework file(s)]
  java -jar APKEditor.jar d -i path/input.apk -framework framework-res.apk
  -framework platforms/android-32/android.jar
  5)  [Decode apk signature block]
  java -jar APKEditor.jar d -t sig -i path/input.apk -sig path/signatures_dir
Notes:
  1)  [internal] Dex builder:
  * Fully supports dex files up to 042.
  * Highest dex file compression.
  * Builds with similar dex-section order as r8/dx.
  * Convenient dex markers editing, see file smali/classes/dex-file.json
  * Additional helpful smali comments: e.g class/method hierarchy.
  * Supports whitespaces on class simple name as introduced on dex 040+
  2)  [-load-dex] To print correct class/method hierarchy, it is necessary to
  load all dex files at once. This may result high memory consumption and
  could fail with "OutOfMemoryError" thus you are required to limit the
  number of dex files to load at a time. You can overcome this problem with
  -Xmx memory arg e.g java -Xmx8g -jar APKEditor.jar ...

2- Build

Builds back to apk from decompiled json/XML files

java -jar APKEditor.jar b -i path/to/decompiled-directory

$ java -jar APKEditor.jar b -i test_json -o test_edited.apk
00.000 I: [BUILD] Using: APKEditor version 1.4.3, ARSCLib version 1.3.6
            -t = xml            
      -dex-lib = jf             
            -i = test_json      
            -o = test_edited.apk
 ______________________________ 
00.005 I: [BUILD] Scanning XML directory ...
00.024 I: [BUILD] Scanning: test_json
00.168 I: [BUILD] Initializing android framework ...
00.168 I: [BUILD] Loading android framework for version: 34
00.254 I: [BUILD] Initialized framework: android-34 (14)
00.254 I: [BUILD] Set main package id from manifest: @mipmap/ic_launcher
00.256 I: [BUILD] Main package id initialized: id = 0x7f, from: @mipmap/ic_launcher
00.256 I: [BUILD] Encoding attrs ...
00.307 I: [BUILD] Encoding values ...
00.560 I: [BUILD] Scan: package_1/res
00.661 I: [BUILD] Scanned 5718 files: package_1/res
00.852 I: [BUILD] Add manifest: AndroidManifest.xml
00.852 I: [BUILD] Building dex ...
00.960 I: [BUILD] (1/2) Cached: classes.dex
00.973 I: [BUILD] (2/2) Cached: classes2.dex
01.033 I: [BUILD] Scanning root directory ...
01.036 I: [BUILD] Restoring original file paths ...
01.078 I: [BUILD] Loading signatures ...
01.082 I: [BUILD] Sorting files ...
01.104 I: [BUILD] Refreshing resource table ...
01.163 I: [BUILD] TableBlock: packages = 1, size = 3067996 bytes
01.164 I: [BUILD] Applying: extractNativeLibs=false
01.164 I: [BUILD] Writing apk...
01.185 I: [BUILD] Buffering compress changed files ...
06.083 I: [BUILD] Writing files: 6637
06.201 I: [BUILD] Writing signature block ...
06.241 I: [BUILD] Saved to: test_edited.apk

more info

Builds android binary from json/xml/raw.
Options:
  -framework            Path of framework file (can be multiple).
  -framework-version    Preferred framework version number
  -i                    Input path.
  -o                    Output path. Optional, if not provided then a new file
                        will be generated on same directory as input
  -res-dir              Sets resource files root dir name. e.g. for obfuscation
                        to move files from 'res/*' to 'r/*' or vice versa.
  -sig                  Signatures directory path.
  -t                    Build types, By default build types determined by quick
                        scanning of input directory files. Values are:
                        [xml, json, raw, sig]
  -extractNativeLibs    Sets extractNativeLibs attribute on manifest and
                        applies compression of library files (*.so).
                          *Default = manifest
                          1) manifest: read and apply from manifest.
                          2) none: remove attribute from manifest and store
                        libraries compressed.
                          3) true: set manifest attribute 'true' and store
                        libraries compressed.
                          4) false: set manifest attribute 'false' and store
                        libraries un-compressed with 4096 alignment.
                        [manifest, none, false, true]
  -dex-lib              Dex library to use:
                         1) internal : Use internal library, supports dex
                        versions up to 042.
                         2) jf : Use library by JesusFreke/smali, supports dex
                        versions 035 and below.
                          *Default = internal
                          *See <Notes> below.
                        [internal, jf]
Flags:
  -dex-profile          Encodes decoded dex profile json files to binary
                        assets/dexopt files.
  -f                    Force delete output path.
  -h | -help | --help   Displays this help and exit.
  -no-cache             Ignore built cached .dex files and re-build smali 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)'
Examples:
  1)  [Basic]
    java -jar APKEditor.jar b -i path/input_directory
  2)  [Specify output]
    java -jar APKEditor.jar b -i path/input_directory -o path/output.apk
  3)  [Restore signatures]
    java -jar APKEditor.jar b -t sig -i path/input.apk -sig
  path/signatures_dir
  4)  [Specify framework]
    java -jar APKEditor.jar b -i path/input_directory -framework
  framework-res.apk -framework platforms/android-32/android.jar

3- Merge

Merges multiple splitted apk files (directory, xapk, apkm, apks ...) to standalone apk

java -jar APKEditor.jar m -i path/to/input

```ShellSession $ java -jar APKEditor.jar m -i apk_files 00.000 I: [MERGE] Using: APKEditor version 1.4.3, ARSCLib version 1.3.6 -i = apk_files
-o = apk_files_merged.apk


00.009 I: [MERGE] Searching apk files ... 00.011 I: [MERGE] Found apk files: 3 00.214 I: [MERGE] Found modules: 3
00.329 I: [MERGE] Merging: base 00.331 I: [MERGE] Added [base] classes.dex -> classes.dex 00.331 I: [MERGE] Added [base] classes2.dex -> classes2.dex 01.289 I: [MERGE] Merging: config.arm64_v8a
01.293 I: [MERGE] Merging: config.xxhdpi
01.634 I: [MERGE] Sanitizing manifest ...
01.637 I: [MERGE] Removed-attribute : splitTypes 01.637 I: [MERGE] Removed-attribute : requiredSplitTypes 01.640 I: [MERGE] Attributes on removed: 0x01010591 (isSplitRequired) 01.641 I: [MERGE] Removed-element : name="com.android.vending.splits.required" 01.641 I: [MERGE] Removed-element : name="com.android.stamp.source" 01.641 I: [MERGE] Removed-element : name="com.android.stamp.type" 01.645 I: [MERGE] Removed-table-entry : res/xml/splits0.xml 01.646 I: [MERGE] Removed-element : name="com.android.vending.splits" 01.646 I: [MERGE] Removed-element : name="com.android.vending.derived.apk.id" 01.779 I: [MERGE] Applying: extractNativeLibs=false 01.779 I: [MERGE] Writing apk ... 01.806 I: [MERGE] Buffering compress changed file

Extension points exported contracts — how you extend this code

ShutdownListener (Interface)
(no doc) [1 implementers]
src/main/java/com/reandroid/commons/utils/ShutdownHook.java
ChildLogger (Interface)
(no doc)
src/main/java/com/reandroid/commons/utils/log/ChildLogger.java

Core symbols most depended-on inside this repo

write
called by 158
src/main/java/com/reandroid/apkeditor/protect/ProtectedFileWriter.java
equals
called by 68
src/main/java/com/reandroid/apkeditor/refactor/TypeNameMap.java
getOptions
called by 51
src/main/java/com/reandroid/apkeditor/protect/Confuser.java
getName
called by 47
src/main/java/com/reandroid/apkeditor/refactor/TypeNameMap.java
logMessage
called by 35
src/main/java/com/reandroid/apkeditor/protect/Confuser.java
writeIndent
called by 34
src/main/java/com/reandroid/apkeditor/info/InfoWriterXml.java
toString
called by 31
src/main/java/com/reandroid/apkeditor/info/InfoWriter.java
getWriter
called by 28
src/main/java/com/reandroid/apkeditor/info/InfoWriter.java

Shape

Method 627
Class 61
Interface 2

Languages

Java100%

Modules by API surface

src/main/java/com/reandroid/apkeditor/refactor/TypeNameRefactor.java44 symbols
src/main/java/com/reandroid/apkeditor/info/Info.java38 symbols
src/main/java/com/reandroid/commons/utils/log/Logger.java30 symbols
src/main/java/com/reandroid/apkeditor/refactor/HtmlColor.java25 symbols
src/main/java/com/reandroid/apkeditor/info/InfoWriterText.java25 symbols
src/main/java/com/reandroid/apkeditor/info/InfoWriterXml.java21 symbols
src/main/java/com/reandroid/apkeditor/refactor/TypeNameMap.java20 symbols
src/main/java/com/reandroid/apkeditor/info/InfoWriter.java20 symbols
src/main/java/com/reandroid/apkeditor/smali/SmaliDecompiler.java19 symbols
src/main/java/com/reandroid/commons/utils/log/FileLogger.java18 symbols
src/main/java/com/reandroid/commons/utils/log/WriterLogger.java17 symbols
src/main/java/com/reandroid/apkeditor/info/InfoWriterJson.java16 symbols

For agents

$ claude mcp add APKEditor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact