Updating the launcher icon from logo.svg
/logo.svg (512×512, project root) is the brand-mark SSOT. The launcher icon is an [adaptive icon] derived from it; never edit the derived drawables as the design source — change logo.svg first, then re-run this procedure.
[adaptive icon]: https://developer.android.com/develop/ui/views/launch/icon_design_adaptive
Layer mapping
| logo.svg element | Android resource | Rule |
| --- | --- | --- |
| Full-bleed background <rect> | drawable/ic_launcher_background.xml | Full-canvas fill of the rect's color only. Drop the corner radius — the launcher applies its own mask shape. |
| Everything else (the mark) | drawable/ic_launcher_foreground.xml | Scaled into the safe zone (math below), centered on the canvas. |
| (same paths) | <monochrome> in mipmap-anydpi/*.xml | Shares the foreground drawable. Opacity differences survive as alpha in themed icons. |
mipmap-anydpi/ic_launcher.xml and ic_launcher_round.xml only reference the two drawables — they normally need no edit.
Safe-zone scaling
This step is the one most often skipped. The adaptive-icon safe zone is the center circle of diameter 66 on the 108 canvas. Copying logo.svg coordinates 1:1 into the foreground clips the mark: the full-bleed logo art reaches the canvas edge, and the launcher mask crops anything outside the safe-zone circle.
Keep the foreground viewport at 512 (matching logo.svg) and shrink the mark into the safe circle:
- Safe radius in 512 units:
512 × 33 / 108 ≈ 156. - Find the mark's farthest extent from its own center
c, including stroke:r_max = max(|p − c|) + strokeWidth / 2over all path end/corner pointsp. scale = 150 / r_max(use ~150, not 156, for breathing room).- Transform every coordinate
p' = 256 + (p − c) × scaleand multiply everystrokeWidthby the samescale. This also re-centers the mark's optical center on (256, 256). - Re-verify after transforming (arithmetic slips here are common): recompute
r'_max = max(|p' − (256, 256)|) + strokeWidth' / 2over the transformed points with a calculator or script rather than by hand — manual arithmetic is the most common source of error here. The procedure is only complete whenr'_max ≤ 156.
Procedure
- Read
/logo.svgand classify elements per the layer-mapping table. - Write the background: 108 viewport, single
M0,0h108v108h-108zpath filled with the logo's background color. Nothing else. - Write the foreground: 512 viewport, one
<path>per SVG element, coordinates transformed by the safe-zone math. Attribute translation:stroke→android:strokeColor,stroke-width→android:strokeWidth,opacityon a stroked path →android:strokeAlpha(on a filled path →android:fillAlpha),stroke-linecap/-linejoin→android:strokeLineCap/LineJoin, no fill →android:fillColor="#00000000". - Monochrome: keep sharing the foreground drawable. Create a dedicated white-stroke drawable only if the mark encodes its hierarchy in color rather than opacity (alpha is all the themed-icon pipeline keeps).
- No rasters:
minSdk = 33, somipmap-anydpialways wins. Do not generatemipmap-*dpiwebp/png fallbacks; delete any that exist. - Verify with the