Inject Flutter runtime into APK workspace
inject_flutter_runtime_and_smaliInject Flutter runtime and Smali payloads into a decompiled APK workspace to embed Flutter code. Select an injection mode to match the target app's structure, enabling native Flutter execution within the host application.
Instructions
Inject a synthesized Flutter payload (lib/ and assets/) and generated Smali bootstrap classes into a decoded APK workspace. Mutates workspaceDir in-place by writing Smali classes, copying native libraries per ABI, and deploying Flutter assets; requires payloadDir containing valid Flutter binaries. Select injectionMode based on target structure: prefer activity_overlay for cached-engine screens, direct_application_hook for custom Application classes, headless_engine for background tasks, or view_tree_injection (experimental); enable nativeLibraryFallback to guard against missing ABI crashes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| engineId | No | Optional cached FlutterEngine identifier stored in FlutterEngineCache (defaults to 'injected_flutter_engine') | |
| payloadDir | Yes | Path to synthesized Flutter payload directory produced by synthesize_flutter_payload containing lib/ native libraries (libflutter.so, libapp.so) and assets/ | |
| workspaceDir | Yes | Path to decompiled APK workspace root directory produced by decompile_apk (modified in-place) | |
| injectionMode | Yes | Injection strategy enum: 'direct_application_hook' (hooks host Application class), 'activity_overlay' (adds overlay Activity), 'view_tree_injection' (attaches FlutterView to main Activity), 'headless_engine' (background engine without UI) | |
| methodChannelBridge | No | Optional MethodChannel bridge config for two-way communication between target Android Smali host and injected Flutter Dart layer | |
| attachBaseContextHook | No | Inject engine init into attachBaseContext(Context) as well as onCreate() for early initialization | |
| nativeLibraryFallback | No | Wrap System.loadLibrary call in defensive try-catch blocks to prevent UnsatisfiedLinkError crashes on missing ABIs |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| engineId | Yes | FlutterEngineCache identifier used by generated code. | |
| warnings | Yes | Compatibility and follow-up warnings. | |
| copiedLibs | Yes | Number of copied native library files. | |
| copiedAssets | Yes | Number of copied Flutter asset files. | |
| workspaceDir | Yes | Mutated decoded APK workspace. | |
| injectionMode | Yes | Applied Flutter integration mode. | |
| methodChannel | No | Configured method-channel bridge, when requested. | |
| modifiedFiles | Yes | Workspace files created or changed by the operation. | |
| generatedClasses | Yes | Generated Smali class descriptors. | |
| launchActivityName | Yes | Resolved activity associated with the selected integration mode. |