Pref Editor: How to Modify Android Preferences in Real-Time During Development


The Android Developer's Preference Testing Nightmare
How many times have you been in this situation? You're developing an Android app, need to test different preference values, and find yourself stuck in this frustrating cycle ๐ข:
Change a preference value in code
Build the app (wait 30+ seconds)
Install on device (wait another 15 seconds)
Navigate to the screen to test
Realize you need a different value
Repeat the entire process
If you're nodding your head, you're not alone. This workflow wastes hours of development time every week. Whether you're working with legacy SharedPreferences or the modern Preferences DataStore, testing different preference configurations shouldn't require constant app rebuilds.
Enter Pref Editor โ a game-changing tool that lets you view and modify Android app preferences directly on your device in real-time, without root access.
What is Pref Editor?
Pref Editor is a developer tool that provides instant access to your Android app's preference files during development. It works with both:
SharedPreferences (legacy preference storage)
Preferences DataStore (modern preference storage)
The Old Way vs. The New Way
Traditional Workflow:
Edit code โ Build โ Install โ Test
2-5 minutes per change
Lost context switching
Multiple APK builds required
With Pref Editor:
Edit preference โ Test immediately
5-10 seconds per change
Stay in testing flow
Zero rebuilds needed
Key Features That Save Development Time
โ No Root Required
Works on any Android device with USB debugging enabled โ no need to root your test devices.
โ Real-Time Editing
Changes take effect immediately without app restarts in most cases.
โ Type Safety
Built-in validation prevents you from saving incompatible data types (e.g., string in an integer field).
โ Rollback Protection
Every edit can be backed up automatically to enable reverting the changes if necessary (desktop version only).
โ AI-Powered Natural Language Control
Use plain English commands like "Toggle the dark mode preference" or "Set user level to 5".
Two Powerful Versions to Choose From
Pref Editor comes in two variants designed for different development workflows:
1. Desktop Application (GUI)
Perfect for visual preference management and team members who prefer graphical interfaces.
Best for:
Developers who prefer visual interfaces
Team members less comfortable with command-line tools
Complex preference debugging sessions
2. MCP Server (AI-Powered)
Ideal for developers who want to integrate preference editing into their AI-assisted workflow.
Best for:
Developers using GitHub Copilot or Claude
Teams adopting AI-driven development workflows
Quick preference changes without leaving the IDE
Natural language preference management
Getting Started: Desktop Application
Prerequisites
Android device with USB debugging enabled
ADB (Android Debug Bridge) installed
Java 17 or higher
Installation & Setup
Download the Desktop App
https://github.com/charlesmuchene/pref-editor-desktop/releases/latest
Enable USB Debugging
Go to Settings โ About Phone
Tap "Build Number" 7 times to enable Developer Options
Go to Settings โ Developer Options
Enable "USB Debugging"
Connect Your Device
# Verify ADB connection adb devices # Should show your device as "device" (not "unauthorized")
Basic Usage Walkthrough
Step 1: Launch and Select Device
Launch Pref Editor Desktop
Your connected devices appear in the listing
Select/filter your target device
Step 2: Choose Your App
Browse/filter installed applications
Search by package name or app name
Select the app whose preferences you want to edit
Step 3: Select Preference File
Common preference file names include:
shared_prefs/[package_name]_preferences.xml
shared_prefs/user_settings.xml
files/datastore/app_config.preferences_pb
Step 4: Edit Preferences
View all preference key-value pairs
Edit any value inline
Changes are validated by data type
Click "Save" to apply changes immediately
Real-World Example: Testing User Onboarding
<!-- Before: User hasn't completed onboarding -->
<boolean name="onboarding_completed" value="false" />
<integer name="onboarding_step" value="0" />
<string name="user_level" value="beginner" />
<!-- After: Simulate experienced user -->
<boolean name="onboarding_completed" value="true" />
<integer name="onboarding_step" value="5" />
<string name="user_level" value="expert" />
Result: Instantly test your app's behavior for users at different onboarding stages without creating multiple test accounts or rebuilding.
Getting Started: MCP Server (AI-Powered)
The MCP (Model Context Protocol) server brings AI-powered preference editing directly to your IDE. Use natural language to modify preferences while coding.
There are plans to re-implement this using ddmlib to take advantage of pre-installed JVM toolchain.
Prerequisites
Node.js 16+ or npx (or use docker image)
Android Studio with GitHub Copilot plugin
OR Claude Desktop
OR VS Code with compatible AI extension
Android Studio Setup
Install the MCP Server
npm install -g @charlesmuchene/pref-editor-mcp-server // OR docker pull charlesmuchene/pref-editor-mcp-server
Configure GitHub Copilot
Open Android Studio
Click the "Agent mode" tab in Copilot
Click "Add tools" button
Click "Add More tools..." (opens mcp.json file)
Add Server Configuration
{ "servers": { "pref-editor-mcp-server": { "type": "stdio", "command": "npx", // or docker "args": ["@charlesmuchene/pref-editor-mcp-server"] } } }
Natural Language Commands You Can Use
// Toggle boolean preferences
"Toggle the dark mode setting"
"Enable notifications for this user"
"Turn off the tutorial flag"
// Update numeric values
"Set the user level to 10"
"Increase the retry count by 5"
"Change the timeout to 30 seconds"
// Modify string preferences
"Update the username to 'testuser123'"
"Set the API endpoint to staging"
"Change the theme to 'material_dark'"
// Add new preferences
"Add a new preference called 'feature_flag_enabled' with value true"
"Create a timestamp preference with the current epoch time"
Example AI Workflow
Developer: "I need to test the premium user experience"
AI + Pref Editor:
โ
Set user_subscription_status to "premium"
โ
Set subscription_expiry to future date
โ
Enable all premium features
โ
Update user tier to "gold"
Developer: "Now test the expired subscription flow"
AI + Pref Editor:
โ
Set subscription_expiry to past date
โ
Set user_subscription_status to "expired"
โ
Disable premium features
โ
Add grace_period_days with value 7
Common Use Cases and Time Savings
1. Feature Flag Testing
Before: Rebuild app for each feature flag combination (5 minutes per test)
After: Toggle flags instantly (10 seconds per test)
Time Saved: 4+ minutes per test ร 10 tests = 40+ minutes daily
2. User State Simulation
Before: Create multiple user accounts or reset app data
After: Modify user preferences directly
Time Saved: 2-3 minutes per user state test
3. API Environment Switching
Before: Change code, rebuild, test each environment
After: Switch API endpoints via preferences
Time Saved: 3-5 minutes per environment switch
4. Onboarding Flow Testing
Before: Clear app data and repeat onboarding
After: Set completion flags and test any step
Time Saved: 5+ minutes per onboarding test
Troubleshooting Common Issues
Device Not Detected
# Check ADB connection
adb devices
# If "unauthorized", check device screen for USB debugging dialog
# If no devices, try:
adb kill-server
adb start-server
Permission Denied Errors
# Ensure USB debugging is enabled
# Try different USB cable (data cable, not charge-only)
# Enable "Disable adb authorization timeout" in Developer Options
App Not Listed
# App must be installed on device
# Some system apps may be filtered out
# Try searching by exact package name
Preferences Not Updating
# Some apps cache preferences - try force-stopping the app
# Verify the correct preference file is selected
# Check if app is using DataStore vs SharedPreferences
Which Version Should You Choose?
Choose Desktop App if:
โ You prefer visual interfaces
โ You frequently do complex preference debugging
Choose MCP Server if:
โ You use AI coding assistants (Copilot, Claude, etc.)
โ You want to stay in your IDE while testing
โ You prefer command-line/text-based workflows
Why Not Both?
Many developers use both versions:
MCP Server for quick changes during active development
Desktop App for detailed debugging sessions and team collaboration
Performance Impact and Best Practices
Performance Considerations
Minimal Impact: Reading preferences has negligible performance overhead
Safe Editing: Type validation prevents crashes from invalid data
Non-Intrusive: No code changes required in your app
Best Practices
Backup Important States: Use the automatic backup feature (only on GUI version) before major changes
Test Edge Cases: Try invalid values to ensure your app handles them gracefully
Document Configurations: Save useful preference combinations as presets
Team Standards: Establish naming conventions for shared preference configurations
Conclusion: Reclaim Your Development Time
Developer time is precious, and every minute spent waiting for builds is a minute not spent solving real problems. Pref Editor transforms Android preference testing from a time-consuming bottleneck into an instant, seamless process.
What You Gain:
2-5 minutes saved per preference change (that's hours per week for most developers)
Faster iteration cycles leading to better-tested features
Reduced context switching and improved focus
Enhanced debugging capabilities for preference-related issues
Better collaboration between developers and QA teams
Getting Started Today:
For GUI lovers: Download Pref Editor Desktop
For AI enthusiasts: Install Pref Editor MCP Server
For teams: Try both and see which fits your workflow better
The future of Android development is about removing friction and focusing on what matters: building great user experiences. Pref Editor is your first step toward a more efficient, enjoyable development process.
Ready to revolutionize your Android preference workflow? Try Pref Editor today and join the developers who've already reclaimed hours of their development time each week.
Happy Androiding! ๐
Additional Resources
Desktop App Repository: Pref Editor Desktop
MCP Server Repository: Pref Editor MCP Server
Docker Hub: Pref Editor MCP Server
Core Library: Pref Editor Library
Issues & Feature Requests: Contribute to the project's development: Desktop App / MCP Server
Subscribe to my newsletter
Read articles from Charles Muchene directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Charles Muchene
Charles Muchene
Software Engineer