I received an APK file which I required to perform reverse engineering on the apk’s code in order to reach a state where the application
builds and runs successfully.
The game is simple: the goal is to survive and reach your city.
At the entrance screen you must enter an ID number, then analysis the code to understand how the game unfolds.
- Open the project in Android Studio.
- Sync Gradle.
- Run the app on an emulator or physical device.
- Enter an ID number on the entry screen.
- Continue the game flow according to the logic discovered in the code.
- A Toast is displayed with the resulting city name.
- Used an online APK decompiler to extract the project contents.
- Created a new empty Android Studio project.
- Copied the Java source files and relevant resource folders (especially
layout/) into the new project.
Some decompiled resources contained invalid naming patterns for Android builds:
- Removed
$symbols from file names. - Removed trailing underscore (
_) from the end of file names where it appeared.
This prevented Gradle/AAPT2 from rejecting resources due to invalid names.
Some XML files starting with AVD* contained <objectAnimator> elements and were placed in the wrong resource directory.
- Moved those
AVD*.xmlfiles into:res/animator/
This resolved errors like: “Element objectAnimator is not allowed here” (caused by placing animator XML under the wrong folder).
Build error encountered:
Illegal char <:> at index 68: ...app-mergeDebugResources...:/values/values.xml
To resolve it, I avoided importing problematic, decompiled “dump” value files and instead:
- Copied only safe and necessary values resources into
res/values/:colors.xmlstrings.xml
- Created a
themes.xmlfile to support the manifest theme reference:@style/Theme.SurviveGame
This prevented corrupted/generated values content from breaking the resource merge step.
I updated the manifest based on Android Studio/AGP warnings and errors, including:
- Ensuring components that require it (Android 12+) explicitly define:
android:exported="true/false"when anintent-filteris present.
- Adjusting manifest configuration to align with modern Gradle namespace handling.
Updated the module build configuration according to the IDE/AGP recommendations, including:
- Proper
namespace - Appropriate
compileSdk / targetSdk / minSdk - Dependency alignment (so resources and themes resolve correctly)
The decompiled res/ contained many files that were not truly part of the app, but rather artifacts of the decompilation process (library/test dumps).
I deleted these dump resources from various res/ subfolders to prevent:
- missing-resource references,
- invalid attribute values,
- and resource linking failures.
To make entering the ID number easier:
- Increased the EditText width on the entry screen for more comfortable input.
The URL stored in strings.xml contained invisible Unicode characters (not visible in the editor), which caused runtime/logic issues.
- I replaced it with a clean URL value (retyped/clean-pasted).
- The final clean paste ID used was:
T67TVJG9
After the app ran successfully on my phone, I debugged the relevant code section and extracted the logic that determines the path/steps.
Direction mapping found in code:
- Right =
1 - Up =
2 - Left =
0 - Down =
3
Extracted the generated STEPS array according to my personal id number:
STEPS = [3, 1, 1, 0, 2, 1, 1, 3, 1]
City selection behavior:
- The resulting array is influenced by the ID number using a modulo 4 operation per digit (as implemented in the code).
- In my case, the chosen location was determined by the 8th digit of the ID number, resulting in index
7→ WASHINGTON.
I fixed constants related to Toast message duration where the units/values were incorrect, so the Toast behaves as expected.
I removed an explicit path reference to Activity_Game from Activity_Menu because the package already contains the correct path resolution.
Throughout the workflow, after major changes (deletions, resource moves, file renames, value edits), I repeatedly executed:
- Clean Project
- Rebuild Project
This ensured Gradle and AAPT2 were always working against an up-to-date state.
- The project builds and runs successfully.
- The Toast city result after “surviving” is:
- WASHINGTON
made with ❤ by Maor Mordo