Decompile APK - Tuong-Nguyen/Android GitHub Wiki

Tool

Online Java Decompiler
This tool can decompile apk file into java code. However, the de-compiled code will have some limitations as described in following sections.

Fix de-compiled code

Layout files

  • Missing closing '>' There are places where closing '>' are missing. We need to put them back.

  • Number is used for attribute's value instead of name The attribute values are numbers instead of name. Therefore, they cannot be compiled. We need to replace them with corresponding name.

<!-- Number is used for android:layout_width -->
<Linearlayout android:layout_width="**-1**">
</Linearlayout>

<!-- Find the corresponding name of -1 value and use it -->
<Linearlayout android:layout_width="**match_parent**">
</Linearlayout>
  • Incorrect reference If the references are used in attribute value, they must be fixed with correct value. De-compiler tool cannot resolve the reference.
<!-- TextApearance refers to a color -->
<TextView android:textAppearance="?unknown_attr_ref:101004">
</TextView>

<!-- Set the correct reference -->
<TextView android:textAppearance="@color/active">
</TextView>

C0010R file

The R class is used for getting resource ID. This is automatically generated. In the apk, it is C0010R. We need to replace all C0010R references with R and remove the C0010R class

// De-compiled code use C0010R
findViewById(**C0010R**.idleButton).setOnClickListener(this);

// Fix - use R class
findViewById(**R**.idleButton).setOnClickListener(this);

Manifest file

All the information in the manifest file is gone. Therefore, we need to add it manually. It means it cannot be restored completely.

⚠️ **GitHub.com Fallback** ⚠️