A command-line tool for renaming Android app package name and app name based on configuration.
- ✅ Validates package name format and app name
- ✅ Shows preview of changes (dry-run mode)
- ✅ Verifies changes after application
- ✅ Git-friendly: Use
git reset --hardto revert changes
- Bun runtime installed
- Android project structure following standard conventions
- Git repository initialized (for reverting changes if needed)
- Create or modify
config.jsonwith your desired app name and package name:
{
"appName": "NewAppName",
"packageName": "com.example.newapp"
}- Run the tool:
# Show changes without applying them
bun run dev --dry-run
# Apply changes
bun run dev
# Use custom config file
bun run dev --config my-config.json- Revert changes if needed:
git reset --hard # Reverts all changes--config, -c: Path to config file (default: config.json)--dry-run, -d: Show changes without applying them
The tool modifies the following files:
android/app/build.gradle.ktsnamespaceapplicationId
android/app/src/main/AndroidManifest.xml- Activity package name
android/app/src/main/res/values/strings.xml- App name string resource
android/settings.gradle.kts- Root project name
Additionally, it moves Kotlin source files to match the new package structure.
The tool performs several validation checks:
-
Package name format validation
- Lowercase letters only
- Valid separator dots
- Each segment starts with a letter
- At least two segments
-
App name validation
- Non-empty
- Valid characters
- Maximum length check
-
File system validation
- Required files exist
- Proper permissions
- Valid file content
# Create config.json
echo '{
"appName": "MyNewApp",
"packageName": "com.example.mynewapp"
}' > config.json
# Preview changes
bun run dev --dry-run
# Apply changes
bun run dev
# If needed, revert changes
git reset --hard