Skip to content

This project showcases my journey in reverse-engineering an Android APK, debugging obfuscated source code, and successfully completing a game through code analysis and logic tracing. I decompiled the APK, fixed critical runtime exceptions, modified UI elements, and decoded a hidden sequence based on a user ID to win the game.

Notifications You must be signed in to change notification settings

YosiBs/APK-Decoding

Repository files navigation

APK Decoding and Bug Fixing Journey

This project involved decoding an APK file, analyzing its source code, fixing bugs, and completing a game to display the final FinishGame Toast message.

Steps to Solve the Bugs and Complete the Game

  1. Decompiled the APK:
    • Used http://www.javadecompilers.com/apk to decode the APK file.
    • Extracted the /sources and /resources folders.
    • Created a new Android Studio project and copied the Activities, layouts, and other required files.
  2. Modified the AndroidManifest.xml:
    • Added the necessary permissions, such as <uses-permission android:name="android.permission.INTERNET" />, to ensure proper functionality.
  3. Identified and Fixed Bugs:
    • Encountered a NullPointerException due to missing or incorrect views in the layout file.
    • Resolved an ArrayIndexOutOfBoundsException caused by accessing invalid indices in the sequence validation logic.
    • Debugged and ensured the arrowClicked() and finishGame() methods worked as expected.
  4. Played the Game to Find the Sequence:
    • The game's goal was to input the correct sequence using the arrow buttons (up, down, left, right).
    • The sequence was derived by taking my ID and applying mod 4 to each digit to generate a sequence of numbers (0, 1, 2, 3).
  5. Completed the Game:
    • Input the correct sequence and fixed bugs until the game displayed the FinishGame Toast message.
    • The final message was: "Survived in <state>" (screenshot attached below).

How to Pass the Game

To pass the game, you need to determine the correct sequence of moves based on your ID. For example, using the ID 123456789:

  1. Take each digit in the ID and calculate digit % 4 to get the sequence:
    • 1 % 4 = 1 → Right
    • 2 % 4 = 2 → Up
    • 3 % 4 = 3 → Left
    • 4 % 4 = 0 → Down
    • 5 % 4 = 1 → Right
    • 6 % 4 = 2 → Up
    • 7 % 4 = 3 → Left
    • 8 % 4 = 0 → Down
    • 9 % 4 = 1 → Right
  2. The final sequence for the ID 123456789 is:
    • Right, Up, Left, Down, Right, Up, Left, Down, Right
  3. Use the arrow buttons to input this sequence into the game to pass!

Identify and Fix Bugs:

Activity_Game.java

  1. Update Toast Messages:

    Change:

      Toast.makeText(this, "Survived in " + state, 1).show();
      } else {
      Toast.makeText(this, "You Failed ", 1).show();

    To:

    Toast.makeText(this, "Survived in " + state, Toast.LENGTH_LONG).show();
    } else {
    Toast.makeText(this, "You Failed ", Toast.LENGTH_LONG).show();
  2. Fix URL Change:‌‌‌

      <string name="url">https://pastebin.com/raw/‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌ZWNJZWNJZWNJT67TVJG9</string>

    To:

        <string name="url">https://pastebin.com/raw/T67TVJG9</string>

    Final Toast Message Screenshot

    A screenshot of the FinishGame Toast message:

    FinishGame Toast Screenshot

Video Demonstration:

Here is a video demonstration of the game:

apkDecodingVideo.mp4

Conclusion

This project was a comprehensive exercise in APK decoding, Android development, and debugging. It tested my ability to decompile and understand existing code, modify and fix bugs, and successfully interact with the app's logic to complete the challenge.

About

This project showcases my journey in reverse-engineering an Android APK, debugging obfuscated source code, and successfully completing a game through code analysis and logic tracing. I decompiled the APK, fixed critical runtime exceptions, modified UI elements, and decoded a hidden sequence based on a user ID to win the game.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages