# Real Racing 3 APK Modification Guide - Community Server Support ## ๐ŸŽฏ Overview This guide shows how to modify the Real Racing 3 APK to support **community server URLs** without breaking the original game. The game already has built-in support for custom servers through its configuration system! --- ## โœจ Good News! The app **already supports custom server URLs** via its configuration system! We just need to: 1. Change the configuration from `"live"` to `"custom"` 2. Add a meta-data entry with your community server URL 3. Repackage and re-sign the APK **No code changes needed!** Just AndroidManifest.xml modifications. --- ## ๐Ÿ“‹ Prerequisites ### Tools Required 1. **APKTool** - For decompiling/recompiling APKs 2. **Uber APK Signer** - For signing the modified APK 3. **Java JDK 8+** - Required by APKTool ### Installation **Windows:** ```bash # Install Chocolatey (if not installed) Set-ExecutionPolicy Bypass -Scope Process -Force iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) # Install Java choco install openjdk11 # Download APKTool # https://ibotpeaches.github.io/Apktool/ # Place apktool.bat and apktool.jar in C:\Windows\ # Download Uber APK Signer # https://github.com/patrickfav/uber-apk-signer/releases ``` **Linux/macOS:** ```bash # Install Java sudo apt install openjdk-11-jdk # Ubuntu/Debian brew install openjdk@11 # macOS # Install APKTool brew install apktool # macOS sudo apt install apktool # Ubuntu/Debian # Download Uber APK Signer wget https://github.com/patrickfav/uber-apk-signer/releases/download/v1.3.0/uber-apk-signer-1.3.0.jar ``` --- ## ๐Ÿ”ง Method 1: Simple Configuration Change (Recommended) This method uses the game's **built-in custom server support**. ### Step 1: Decompile the APK ```bash # Navigate to APK location cd E:\rr3 # Decompile apktool d realracing3.apk -o rr3-modded ``` ### Step 2: Edit AndroidManifest.xml Open `rr3-modded\AndroidManifest.xml` and find this section (around line 225): **BEFORE:** ```xml ``` **AFTER:** ```xml ``` **Replace `https://your-server.com` with your actual community server URL!** ### Step 3: Recompile the APK ```bash apktool b rr3-modded -o realracing3-community.apk ``` ### Step 4: Sign the APK ```bash # Using Uber APK Signer java -jar uber-apk-signer.jar --apks realracing3-community.apk # Or using jarsigner (manual) keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore my-release-key.jks realracing3-community.apk my-key-alias ``` ### Step 5: Install on Device ```bash # Uninstall original (if installed) adb uninstall com.ea.games.r3_row # Install modified APK adb install realracing3-community-signed.apk ``` **Done!** The game will now connect to your community server. --- ## ๐Ÿ”ง Method 2: Dynamic Server Switching (Advanced) This creates **two separate APK versions** - one for official servers, one for community servers. ### Create Community APK 1. Follow Method 1 steps 1-4 2. Rename the output: `realracing3-community.apk` ### Create Official APK (Unmodified) 1. Keep original `realracing3.apk` 2. Re-sign it with the same certificate: ```bash java -jar uber-apk-signer.jar --apks realracing3.apk ``` ### Usage - **Official servers**: Install `realracing3.apk` - **Community servers**: Install `realracing3-community.apk` Switch by uninstalling one and installing the other. --- ## ๐Ÿ”ง Method 3: Shared Preferences Override (Requires Root) For advanced users with rooted devices - override server URL at runtime. ### Create Override Script ```bash # Create override script cat > /data/data/com.ea.games.r3_row/shared_prefs/rr3_community.xml << 'EOF' https://your-server.com EOF # Set permissions chmod 660 /data/data/com.ea.games.r3_row/shared_prefs/rr3_community.xml chown u0_a123:u0_a123 /data/data/com.ea.games.r3_row/shared_prefs/rr3_community.xml ``` ### Modify Java Code to Read Preferences This requires smali editing - see Advanced section below. --- ## ๐Ÿ› ๏ธ Advanced: Add In-Game Server Switcher For maximum flexibility, add a settings UI to switch servers in-game. ### Step 1: Create Settings Activity Create `rr3-modded/smali/com/firemint/realracing/CommunityServerSettings.smali`: ```smali .class public Lcom/firemint/realracing/CommunityServerSettings; .super Landroid/app/Activity; .method protected onCreate(Landroid/os/Bundle;)V .locals 2 # Show simple dialog with server URL input # Implementation details omitted for brevity return-void .end method ``` ### Step 2: Add Settings Button This is complex and requires understanding of the game's UI structure. Alternative: use external app. --- ## ๐Ÿ“ฑ Automated Solution: Community Server Manager App The easiest approach for users: Create a separate **Community Server Manager** app. ### Create Android App ```kotlin // MainActivity.kt class ServerManagerActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val serverUrlInput = findViewById(R.id.serverUrl) val applyButton = findViewById