A modified build of Krita 5.3.1.1 (arm64-v8a) tailored for smartphone screens, paired with an embedded Krita MCP Server (Blender-MCP architecture) for Antigravity.
Download the signed, ready-to-install APK from GitHub Releases:
- Release:
v5.3.1.1-smartphone-mcp - File:
krita-arm64-v8a-5.3.1.1-smartphone-mcp-signed.apk(159.1 MB) - SHA-256:
d65a4939f79f74ae9f68f82b83832a1f3a92d5d635f71a874030b124e30643f8
Note
The APK is distributed via GitHub Releases because it exceeds GitHub's 100 MB per-file Git object limit.
- Smartphone Screen & Background Manifest (
scripts/patch_manifest.py)- Enables
android:smallScreens="true"andandroid:normalScreens="true". - Enables
android:name="android.app.background_running" android:value="true"and setsQT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED=0so Krita's Qt event loop stays alive when Antigravity sends MCP commands in the background. - Declares
FOREGROUND_SERVICE_SPECIAL_USE,POST_NOTIFICATIONS,WAKE_LOCK, andorg.krita.android.McpForegroundService.
- Enables
- Fractional HiDPI Scaling (
PassThrough, default1.55x)- Prevents Qt5 on Android from rounding
2.625x(420dpi) up to3.0xon1080x2400phones (360x800logical px). With1.55x, the workspace expands to~697x1470(portrait) /~1470x697(landscape). - Configurable at runtime via
control_ui_and_view(phone_scale) or/sdcard/Android/data/org.krita/files/krita_phone_scale.txt.
- Prevents Qt5 on Android from rounding
- Responsive Smartphone UI & Quick-Bar
- Automatically clamps
QDialogwindows inside the available screen bounds. - Tabifies dockers cleanly to the Bottom (portrait) or Right (landscape) with compact
18x18toolbar icons. - Adds a touch-friendly Smartphone Quick-Bar:
Dockers,Canvas,PhoneFit,Undo,Redo,FitZoom,Save, andMCP:9876(with live Foreground Service indicator).
- Automatically clamps
- Background & Lockscreen Foreground Service (
classes2.dex+classes.dexpatch)org.krita.android.McpForegroundService(specialUse,android:permission="android.permission.DUMP") keeps a persistent "Krita MCP Active" notification and a continuousPARTIAL_WAKE_LOCKso Android does not freeze Krita while minimized or while the screen is off/locked.scripts/patch_dex.pysurgically NOPsMainActivity.onStart()'s unguardedstartService(DocumentSaverService)call inclasses.dexto preventBackgroundServiceStartNotAllowedExceptionduring cold-starts behind the lockscreen.- Includes a headless
QtLayoutreflection kickstart (ensureQtStarted()) +ACTION_USER_PRESENTunlock listener, and defersWindow::addView()while the screen is off or locked (!isScreenReadyForView()), attaching views safely350msafter unlock/resume. get_krita_inforeportswake_lock_held,battery_optimization_ignored,screen_interactive, anddevice_locked, andkrita_mcp_server.pyauto-applies Doze/AppOps exemptions and startsMcpForegroundServicefirst whenrishis available.- Validates
QPointer<KisDocument>strongref counts before every document access, serializesMcpEventdispatch to prevent nested-event-loop re-entrancy, and provides an idempotentclose_documenttool. save_documentenablesbatchmode(true)and saves raster formats (.png,.jpg,.webp,.bmp) directly fromdoc->projection()without blocking GUI dialogs.
- Embedded Native Bridge (
native/krita_phone_mcp_bridge.cpp→libdummytrivialinterface_arm64-v8a.so): Runs insideorg.krita, listens on127.0.0.1:9876with heap-refcountedstd::shared_ptr<McpRequest>synchronization, serialized non-reentrant Qt dispatch, liveQPointerdocument lifecycle validation, lock-free<1msTCPping,batch_commands, SVG Bezierpath&blend_modesupport indraw_shapes, andlibkritalibkis/QJSEngineintegration. - MCP Server (
krita_mcp_server.py): Stdio JSON-RPC 2.0 server (plus--climode) with a persistent keep-alive TCP client, adaptive per-tool timeouts (20s–120s), and optional auto-launch via Shizuku (rish) when Krita is closed. Once Krita is open, all MCP tools run without Shizuku.
| Category | Tools |
|---|---|
| Status & Inspection | get_krita_info, get_document_info, get_layer_info, get_canvas_screenshot, list_resources |
| Document & Layers | create_document, open_document, save_document, close_document, create_layer, modify_layer |
| Drawing & Vectors | set_brush_and_colors, paint_strokes, draw_shapes (fills, gradients, rects, ellipses, lines, polygons, SVG path, blend_mode, wrapped aligned text), add_vector_svg |
| Filters & Selection | apply_filter, manage_selection |
| UI, Batch & Scripting | control_ui_and_view, batch_commands, execute_krita_code |
{
"mcpServers": {
"krita": {
"command": "python3",
"args": ["/storage/emulated/0/Documents/Mod/krita-mcp/krita_mcp_server.py"]
}
}
}JoJo vs DIO Manga Scene (scripts/draw_jojo_vs_dio.py) |
Stickman Demo |
|---|---|
![]() |
![]() |
android/org/krita/android/McpForegroundService.java:specialUseForeground Service + continuousPARTIAL_WAKE_LOCK+ headlessImageReadersurface feeder & unlock handoff for background, Doze, and lockscreen reliability.native/krita_phone_mcp_bridge.cpp: Native C++ bridge (libdummytrivialinterface_arm64-v8a.so) for smartphone scaling, Quick-Bar, dialog clamping, and the127.0.0.1:9876MCP TCP server.scripts/patch_manifest.py: BinaryAndroidManifest.xmlpatcher (smallScreens,normalScreens,background_running, FGS +WAKE_LOCK+REQUEST_IGNORE_BATTERY_OPTIMIZATIONSpermissions/service).scripts/patch_dex.py: Surgicalclasses.dexpatcher preventingMainActivity.onStart()BackgroundServiceStartNotAllowedExceptionand bypassingQtNative.m_activityPausedstalls inrunAction()/runPendingCppRunnablesOnAndroidThread()for cold-starts behind the lockscreen.scripts/build_apk.py: Repackages,zipaligns, and signs the APK (classes.dex,classes2.dex,AndroidManifest.xml,libdummytrivialinterface_arm64-v8a.so).scripts/build_all.py: One-command build pipeline (manifest +classes2.dex+ native C++ + 0-unresolved-symbol check + APK signing).scripts/draw_jojo_vs_dio.py: Demo script rendering the JoJo vs DIO manga confrontation via Krita MCP.krita_mcp_server.py: JSON-RPC 2.0 MCP server (stdio+--cli) exposing 20 tools to Antigravity.
python3 scripts/build_all.py
