A native C tool that decompiles Android APK files and reconstructs clean, compilable Android Studio Gradle projects with target source code in either Kotlin (.kt) or Java (.java).
- Native C Implementation: Written in C for fast execution and lightweight overhead.
- Dual Target Language Support: Decompile and transpile APKs into Kotlin (
.kt) or Java (.java) source trees. - Automatic Package Extraction: Parses package names and components directly from the decompiled
AndroidManifest.xml. - Complete Gradle Project Structure: Generates
settings.gradle.kts,build.gradle.kts,gradle.properties,app/build.gradle.kts, andapp/src/main/AndroidManifest.xml. - Resource Sanitization & Preservation: Extracts layouts, drawables, values, and XML resources while sanitizing invalid file names.
- Modular Design: Separated into single-function C modules with header declarations and a unified Makefile.
- Multiplatform: Support for android (arm64 & x86_64), windows (arm64 & x86_64) and GNU linux (arm64 & x86_64).
- One script: Just download the script for your os and execute it and it will do everything.
The codebase is organized under src/ into distinct modules:
| Module File | Header | Description |
|---|---|---|
src/apk_to_smali.c |
src/apk_to_smali.h |
Extracts resources, Smali code, and AndroidManifest.xml via apktool |
src/dex_to_smali.c |
src/dex_to_smali.h |
Disassembles raw .dex bytecode files to .smali |
src/smali_to_kotlin.c |
src/smali_to_kotlin.h |
Decompiles bytecode and handles Kotlin (.kt) or Java (.java) transpilation |
src/manifest_parser.c |
src/manifest_parser.h |
Extracts package="..." attribute from decompiled XML manifests |
src/gradle_generator.c |
src/gradle_generator.h |
Creates Kotlin DSL Gradle build scripts and properties |
src/file_utils.c |
src/file_utils.h |
Manages file I/O, directory creation, recursive copying, and resource sanitization |
src/main.c |
N/A | Main CLI entrypoint parsing arguments and driving execution |
Ensure the following dependencies are installed and available in system environment or binary paths:
- GCC (
gcc) and Make (make) - JDK 17 or higher (
java) apktool(in system PATH)jadx(in system PATH)
To compile the native C binary in your arch using the provided Makefile:
make clean && make <win-x86_64|win-arm64|linux-x86_64|linux-arm64|android-x86_64|android-arm64>Or to build all:
make clean && make allThe compiled binaries will be placed at bin/apk2kotlin.
bin/apk2kotlin <input_apk> <output_project_dir> [kotlin|java]<input_apk>: Path to the target.apkfile.<output_project_dir>: Path where the generated Android Studio Gradle project will be created.[kotlin|java](Optional): Target programming language for source output.kotlin(default): Places.ktsource files inapp/src/main/kotlin/.java: Places.javasource files inapp/src/main/java/.