Kuikly Framework Adaptation to HarmonyOS: Architecture, Performance, and Rendering Solutions
Kuikly, Tencent’s Kotlin Multiplatform‑based cross‑platform framework, has been extended to support HarmonyOS with native performance, offering Compose DSL, high‑performance rendering, Kotlin Native adaptation, debugging tools, and detailed optimization strategies that achieve near‑native speed and dynamic UI capabilities across Android, iOS, Web, and mini‑programs.
Background
Kuikly is a widely used cross‑platform development framework built on Kotlin Multiplatform, launched by Tencent's Oteam. It now supports the HarmonyOS platform and Compose DSL, enabling unified development across Android, iOS, Web, mini‑programs, and HarmonyOS, and has been deployed in several Tencent products.
HarmonyOS Adaptation Scheme
Kuikly focuses on high performance and dynamic rendering. Early adaptation to HarmonyOS Next achieved native‑level performance, with measured results showing page‑open speed up to 6× faster than React Native and comparable to Android native.
Overall Adaptation Overview
The adaptation involves integrating with HarmonyOS UI, wrapping atomic components, handling events, and compiling Kotlin Multiplatform logic to efficient native binaries. It also includes bridging between cross‑platform and native layers, and building debugging, crash‑monitoring, and other tooling.
Rendering Layer Adaptation
ArkUI Rendering Mapping
HarmonyOS uses declarative ArkUI, which required a new rendering approach. Initial solutions using full‑property binding caused performance issues; the final solution adopted a command‑style CAPI to map rendering instructions efficiently.
C‑Node and ArkTS Component Nesting
A shadow‑node technique and later content‑slot support were introduced to allow seamless mixing of C‑nodes and ArkTS components without breaking UI hierarchy.
Text Rendering Optimization
Multiple iterations moved from separate measurement/rendering to reusing layout results and finally to direct system text drawing via CAPI, eliminating costly re‑layout and achieving expected performance.
Other Performance and Stability Issues
High‑frequency node creation was mitigated with a whitelist/blacklist reuse strategy, and stability was improved by addressing crashes in XComponent and system APIs.
KuiklyBase Adaptation to HarmonyOS
Kotlin Native Support
Kotlin Native was chosen over Kotlin JS due to a 950% performance gap. The build pipeline uses Apple LLVM for IR generation and HarmonyOS LLVM for final binary, achieving compatible native performance after further optimizations such as inlining and coroutine tuning.
Debugging Efficiency
A custom plugin for HarmonyOS IDE automates Kotlin Native debugging setup, reducing configuration steps and improving debugging speed by 40×, eventually planned for release in the IDE plugin marketplace.
ComposeDSL Beta Release
The Beta adds standard Compose DSL support across Android, iOS, HarmonyOS, Web, and mini‑programs, retaining Kuikly’s native rendering advantages and dynamic capabilities like hot‑updates.
Technical Outlook
Future work includes continuous HarmonyOS adaptation, improving Kotlin Native GC, and extending support to Android Studio for a unified development experience.
Tencent Technical Engineering
Official account of Tencent Technology. A platform for publishing and analyzing Tencent's technological innovations and cutting-edge developments.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.