> For the complete documentation index, see [llms.txt](https://mobile.mrw0l05zyn.cl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mobile.mrw0l05zyn.cl/android/analisis-estatico/reversing/aplicaciones-nativas/java-kotlin.md).

# Java / Kotlin

## Tabla de conversión de archivos

| Archivo de origen | Archivo resultante |         Herramienta        |
| :---------------: | :----------------: | :------------------------: |
|        .apk       |        .dex        | unzip (desempaquetar .apk) |
|        .dex       |        .jar        |           dex2jar          |
|        .jar       |       .class       |           JD-GUI           |
|        .apk       |       .smali       |           Apktool          |
|        .dex       |       .smali       |          baksmali          |
|        .apk       |       .class       |            jadx            |

## Desempaquetar APK

```shell
cp application.apk application.zip
unzip application.zip -d app-unpacked
```

## Apktool

* Desde `.apk` a `.smali`

### Descompilar APK <a href="#apktool-descompilar-apk" id="apktool-descompilar-apk"></a>

```shell
apktool d application.apk -o app-decompiled
```

### Compilar APK <a href="#apktool-compilar-apk" id="apktool-compilar-apk"></a>

```shell
apktool empty-framework-dir

# General
apktool b app-decompiled -o app-compiled.apk

# AAPT2 (Android Asset Packaging Tool)
apktool b --use-aapt2 app-decompiled -o app-compiled.apk
```

## APKLab

* <https://apklab.surendrajat.xyz/>

## baksmali

* Desde `.dex` a `.smali`

```shell
java -jar baksmali.jar d <file.dex>
cd out
```

## dex2jar

* Desde `.apk` a `.jar` o `.dex` a `.jar`

```shell
# Desempaquetar APK
cp app.apk app.zip
unzip app.zip -d app-unpacked

# .dex a .jar
cd app-unpacked
d2j-dex2jar <file.dex>

# .apk a .jar
d2j-dex2jar app.apk -o app.jar
```

## jadx

```shell
jadx -d $(pwd)/app-decompiled $(pwd)/<file>
jadx-gui $(pwd)/<file>
```

* \<file> = `.apk`, `.dex`, `.jar`, `.class`, `.smali`, `.zip`, `.aar`, `.arsc`.

## JD-GUI

* Desde `.jar` a `.class`

```shell
java -jar jd-gui.jar <file.jar>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mobile.mrw0l05zyn.cl/android/analisis-estatico/reversing/aplicaciones-nativas/java-kotlin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
