From 0daa89e935392bb05addc670e0eb9016ed4725d3 Mon Sep 17 00:00:00 2001 From: ssfdre38 Date: Tue, 24 Feb 2026 22:32:41 -0800 Subject: [PATCH] Fix critical version code formula bug Changed formula from (major*100000 + minor*1000 + patch) to the correct (major*10000 + minor*100 + patch) to match UpdateManager.smali implementation. Updated all examples: - 14.5.0 = 140500 (0x224D4) not 145000 - Corrected hex values throughout documentation This bug would have prevented OTA updates from working correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- INTEGRATION-GUIDE.md | 18 +++++++++--------- README.md | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/INTEGRATION-GUIDE.md b/INTEGRATION-GUIDE.md index e5d1635..99e5863 100644 --- a/INTEGRATION-GUIDE.md +++ b/INTEGRATION-GUIDE.md @@ -101,18 +101,18 @@ Edit `smali/com/community/UpdateManager.smali`: ```smali .field private static final CURRENT_VERSION:Ljava/lang/String; = "14.5.0" # Your version -.field private static final CURRENT_VERSION_CODE:I = 0x23AB8 # 145000 in hex +.field private static final CURRENT_VERSION_CODE:I = 0x224D4 # 140500 in hex ``` **Calculate version code:** ``` -versionCode = (major * 100000) + (minor * 1000) + patch +versionCode = (major * 10000) + (minor * 100) + patch Examples: -14.5.0 → 145000 → 0x23AB8 (hex) +14.5.0 → 140500 → 0x224D4 (hex) 15.0.0 → 150000 → 0x249F0 (hex) -# Convert to hex: printf '%x\n' 145000 +# Convert to hex: printf '%x\n' 140500 ``` #### Update Manifest URL @@ -350,12 +350,12 @@ curl https://raw.githubusercontent.com/YOUR-ORG/YOUR-REPO/main/versions.json **Fix:** ```bash # Calculate version code -echo "scale=0; (14*100000) + (5*1000) + 0" | bc -# Result: 145000 +echo "scale=0; (14*10000) + (5*100) + 0" | bc +# Result: 140500 # Convert to hex -printf '%x\n' 145000 -# Result: 23ab8 +printf '%x\n' 140500 +# Result: 224d4 # Update in smali: .field private static final CURRENT_VERSION_CODE:I = 0x23ab8 @@ -451,7 +451,7 @@ gh repo create YOUR-ORG/rr3-releases --public "versions": [ { "version": "14.5.0", - "version_code": 145000, + "version_code": 140500, "channel": "stable", "release_date": "2026-02-24", "min_android": 21, diff --git a/README.md b/README.md index 7a387f2..cb8eafb 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ private static final int CURRENT_VERSION_CODE = 150000; **Version Code Formula:** ``` -versionCode = (major * 100000) + (minor * 1000) + patch +versionCode = (major * 10000) + (minor * 100) + patch Examples: 15.0.0 → 150000