Inject Flutter runtime into APK workspace
inject_flutter_runtime_and_smaliInject a Flutter runtime and Smali bootstrap into a decompiled APK workspace to enable Flutter execution in the host app through configurable injection modes.
Instructions
Inject a synthesized Flutter payload and generated Smali bootstrap into a decoded APK workspace after decompile_apk and synthesize_flutter_payload have completed. This mutates workspaceDir by adding libraries, assets, and Smali files; run analyze_injection_surface first when the host lifecycle or ABI compatibility is uncertain. Choose activity_overlay for the supported cached-engine screen path, use direct_application_hook only for a resolvable host Application, and treat view_tree_injection as experimental because it requires a lifecycle-compatible host.
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. |