Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

📖 Android Reverse Engineering & Modernization


A deep-dive reverse engineering project surgical Smali-level patching of a 2010 legacy APK targeting Android 4.3 Jelly Bean (API 18), fully modernized and production-signed for Android 16 (API 35) without having a single line of Java source code.


LicenseStarsForksIssues


What is ThisWhy This RepoSDK ChangesTopics CoveredTools UsedBuild SetupHow to RebuildWho is This ForRepo StatsLicenseSupport


📋 Table of Contents


🔍 What is This

The Android application is a massive offline Vedic scripture reader built around a 1.1 GB proprietary .ivd database file. Originally released targeting Android 4.3 Jelly Bean (API 18), the application became completely non-functional on modern Android versions due to three compounding failures scoped storage enforcement, unsigned APK rejection, and deprecated file I/O APIs.

This project performs end-to-end reverse engineering of the APK entirely at the Smali (Dalvik bytecode) level. No decompiled Java source was required. Key surgical patches were injected into MainActivity.onCreate, permission declarations were updated in AndroidManifest.xml, and welcome screen strings were modernized directly inside .smali producing a fully signed, zipaligned, production-ready APK that runs flawlessly on Android 16 (API 35).

🧠 Core Discovery

During analysis, the proprietary .ivd file format was identified to be a standard SQLite database with a renamed extension. This eliminated the need for any custom parser and allowed the existing high-performance rendering pipeline to be preserved entirely without modification.

⚠️Disclaimer: This project is strictly for educational and personal use only. All rights to the original Vedabase application and its content belong to their respective copyright holders. No proprietary content is redistributed in this repository.


💡 Why This Repo

#ProblemRoot CauseSolution Applied
1App hard-crashed on Android 11+ launchScoped storage enforcement blocked all legacy File() absolute path readsInjected MANAGE_EXTERNAL_STORAGE runtime permission request into MainActivity.onCreate via Smali
21.1 GB .ivd database completely unreadableOS blocked access via legacy absolute paths on API 30+Reverse engineered .ivd format confirmed standard SQLite; patched file access path resolution
3APK refused to install on modern devicesPackage was unsigned rejected by Android Package Manager on API 26+Signed with apksigner (v1 + v2 schemes) + zipaligned using Android Build Tools 34.0.0
4targetSdkVersion critically outdatedOriginally API 18 triggered legacy compatibility shims causing instabilityUpdated to targetSdkVersion 33 modern runtime behaviour, no strict API 34 restrictions
5Welcome screen broken with dead linksHardcoded legacy troubleshooting URLs in const-string values inside .smaliRewrote all affected const-string entries cleaner header, removed dead links, added attribution
6ARM64 compatibility unknownSource architecture undocumentedConfirmed pure Java logic zero native .so libraries natively compatible with all ARM64-v8a devices

📱 SDK Version Changes

PropertyOriginal APKModified APK
Min SDK Version14 Android 4.0 Ice Cream Sandwich14 Preserved (maximum device reach maintained)
Target SDK Version18 Android 4.3 Jelly Bean33 Android 13 Tiramisu
Compile SDKUnknown / pre-API 19 toolchainBuild Tools 34.0.0
Compatible Up ToAndroid 4.3 effectively broken on Android 5.0+Android 16 (API 35) fully verified
Native LibrariesARMv7 onlyNone required pure Java, all ABIs supported
APK Signing SchemeUnsignedv1 (JAR) + v2 (APK Signature Block) via apksigner
Storage PermissionNone declaredMANAGE_EXTERNAL_STORAGE runtime-requested on API 30+

📚 Topics Covered

  • Android APK structure analysis and decompilation with APKTool
  • Smali / Dalvik bytecode reading, understanding opcodes, and writing surgical patches
  • Scoped Storage (API 30+) runtime MANAGE_EXTERNAL_STORAGE injection into existing bytecode
  • Proprietary file format reverse engineering identifying SQLite inside .ivd
  • targetSdkVersion and minSdkVersion strategy across Android API generations
  • APK signing with apksigner (v1 + v2 signature schemes)
  • APK alignment with zipalign for memory-mapped I/O optimization
  • Debug keystore generation with keytool
  • Java source decompilation and cross-referencing with JADX
  • Multi-version Android compatibility testing (Android 11 through 16)
  • Smali string patching const-string, \n, \' escape sequences, multi-line formatting
  • AndroidManifest.xml permission and SDK attribute modification
  • Welcome screen UI modernization via direct Smali and resource patching
  • APK verification with apksigner verify

🛠️ Tools Used

ToolVersionPurposeDownload
APKToolv2.10.0Decompile APK → Smali + XML resources; recompile back to unsigned APKapktool_2.10.0.jar
uber-apk-signerv1.3.0One-command APK signing + zipalign; supports v1/v2/v3 schemesuber-apk-signer-1.3.0.jar
JADXv1.5.0Decompile APK to readable Java source for static analysis and cross-referencingjadx-1.5.0.zip
apksignerBuild Tools 34.0.0Low-level APK signing with explicit v1/v2 scheme controlBundled with Android Build Tools
zipalignBuild Tools 34.0.0Align APK entries on 4-byte boundaries for runtime memory efficiencyBundled with Android Build Tools
Android SDK Managercmdline-tools r11Install and manage Android Build Tools and platform componentscommandlinetools-linux
keytoolJDK 21.0.9 LTSGenerate RSA-2048 debug keystore for APK signingBundled with JDK
OpenJDK21.0.9 LTSRuntime for APKTool, uber-apk-signer, apksigner, and keytooladoptium.net
Zed EditorLatestPrimary editor for Smali bytecode and XML resource modificationzed.dev
Android StudioLatestEmulator testing, ADB device management, and logcat debuggingdeveloper.android.com/studio

⚙️ Build Environment Setup

Complete environment setup on Ubuntu 22.04 / Debian or WSL2 on Windows.

Step 1 Install Java 21 LTS

sudo apt-get update && sudo apt-get install -y wget unzip curl
# Install OpenJDK 21
sudo apt-get install -y openjdk-21-jdk
# Verify
java -version
# Expected: java version "21.0.9" 2025-10-21 LTS

Step 2 Download APKTool v2.10.0

# Download the APKTool wrapper script
wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool \
-O /usr/local/bin/apktool
chmod +x /usr/local/bin/apktool
# Download APKTool JAR v2.10.0
wget https://github.com/iBotPeaches/Apktool/releases/download/v2.10.0/apktool_2.10.0.jar \
-O /usr/local/bin/apktool.jar
chmod +x /usr/local/bin/apktool.jar
# Verify
apktool --version
# Expected: 2.10.0

Step 3 Download uber-apk-signer v1.3.0

wget https://github.com/patrickfav/uber-apk-signer/releases/download/v1.3.0/uber-apk-signer-1.3.0.jar \
-O /usr/local/bin/uber-apk-signer.jar
# Verify
java -jar /usr/local/bin/uber-apk-signer.jar --version
# Expected: uber-apk-signer v1.3.0

Step 4 Download JADX v1.5.0 (for static analysis)

wget https://github.com/skylot/jadx/releases/download/v1.5.0/jadx-1.5.0.zip \
-O /tmp/jadx.zip
unzip /tmp/jadx.zip -d /opt/jadx
export PATH="/opt/jadx/bin:${PATH}"# Verify
jadx --version
# Expected: 1.5.0

Step 5 Install Android Command Line Tools & Build Tools 34

wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \
-O /tmp/cmdline-tools.zip
mkdir -p /opt/android-sdk/cmdline-tools
unzip /tmp/cmdline-tools.zip -d /opt/android-sdk/cmdline-tools
mv /opt/android-sdk/cmdline-tools/cmdline-tools \
/opt/android-sdk/cmdline-tools/latest
# Accept licenses and install Build Tools 34
yes | /opt/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses
/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0"# Add to PATHexport PATH="/opt/android-sdk/build-tools/34.0.0:${PATH}"# Verify
zipalign --version
apksigner --version

💡 Add all export PATH lines to ~/.bashrc or ~/.zshrc to make them permanent across sessions.

Step 6 Generate Debug Keystore

keytool -genkey -v \
-keystore debug.keystore \
-storepass android \
-alias androiddebugkey \
-keypass android \
-keyalg RSA \
-keysize 2048 \
-validity 10000 \
-dname "CN=Android Debug,O=Android,C=US"

🔨 How to Rebuild

With the environment set up and decompiled_apk/ directory containing all applied patches:

Option A Using uber-apk-signer (Recommended one command signs + aligns)

# Step 1: Recompile Smali + resources back to unsigned APK
apktool b decompiled_apk -o vedabase_unsigned.apk
# Step 2: Sign and zipalign in a single command
java -jar /usr/local/bin/uber-apk-signer.jar \
--apks vedabase_unsigned.apk \
--allowResign \
--overwrite
# Output: vedabase_unsigned-aligned-signed.apk

Option B Manual apksigner + zipalign (Granular control)

# Step 1: Recompile
apktool b decompiled_apk -o app-unaligned.apk
# Step 2: Zipalign
zipalign -p -f 4 app-unaligned.apk app-aligned.apk
# Step 3: Sign with explicit v1 + v2 schemes
apksigner sign \
--ks debug.keystore \
--ks-pass pass:android \
--v1-signing-enabled true \
--v2-signing-enabled true \
app-aligned.apk
# Step 4: Verify signature
apksigner verify --verbose app-aligned.apk

Install on Device

adb install app-aligned.apk
# or for reinstall
adb install -r app-aligned.apk

🎯 Who is This For

✅ Android reverse engineers studying real-world Smali patching
✅ Security researchers analyzing legacy APK structures and storage patterns
✅ Devotees requiring Vedabase to run on Android 11, 12, 13, 14, 15, or 16
✅ Developers learning scoped storage migration without Java source access
✅ Students studying APK decompilation, bytecode injection, and re-signing
✅ Engineers learning the full APKTool → patch → sign → verify pipeline
✅ Anyone studying proprietary file format identification (SQLite inside .ivd)
❌ Not for commercial redistribution of the patched APK
❌ Not a replacement for the official Vedabase platform or website
❌ Not for bypassing DRM, copy protection, or proprietary licensing

📊 Repo Stats

Last CommitRepo SizeTop LanguageJava VersionAPKTooluber-apk-signerJADXBuild Tools


📄 License

This project is licensed under the MIT License see the LICENSE file for details.

The original Vedabase application, its content, and the .ivd database files belong entirely to their respective copyright holders. This repository documents only the technical reverse engineering and patching process for educational purposes. No proprietary content, database files, or original APK binaries are redistributed here.


🤝 Support

If this project helped you, consider leaving a ⭐ it helps other reverse engineers find this work.

For technical questions, reproduction issues, or patch improvements open a GitHub Issue.


Made with ❤️ by hackthacker

About

Expert reverse engineer specializing in binary analysis, malware research, and low-level system internals. Experienced in dissecting complex software, uncovering vulnerabilities, and understanding code beyond source-level abstraction

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors