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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user