Mobile Development 11 min read

Harmony OS Cross‑Device Compatibility: Architecture, Java & Ark Compiler

This article reviews Harmony OS, detailing its distributed architecture, four key technical features, the concept of cross‑platform as cross‑device, compares Java and Android’s compilation approaches, and explains how Huawei’s Ark Compiler and multi‑device IDE enable true cross‑device development and efficient execution across phones, wearables, cars and other smart devices.

macrozheng
macrozheng
macrozheng
Harmony OS Cross‑Device Compatibility: Architecture, Java & Ark Compiler

Harmony OS Review

On August 9, 2019, at the Huawei Developer Conference, Huawei Consumer Business CEO Yu Chengdong announced the release of Huawei's own operating system, Harmony OS, built on the Linux kernel, a micro‑kernel, and LiteOS. Future versions aim to rely solely on the micro‑kernel.

Harmony OS (Harmony OS, development codename Ark) is a cross‑platform operating system developed by Huawei since 2012, potentially compatible with Android applications.

Four Key Technical Features

Distributed architecture used for the first time in a terminal OS, achieving seamless cross‑device collaboration.

Deterministic latency engine and high‑performance IPC technology provide inherent system smoothness.

Micro‑kernel architecture reshapes device trust and security.

Unified IDE supports one‑click development and multi‑device deployment, enabling ecosystem sharing across terminals.

What Is Cross‑Platform

Historically,

platform ≈ operating system

, meaning an application could run on different OSes without hardware dependence. With modern technology,

platform ≈ device

. Harmony OS can run on phones, watches, computers, cars, smart home devices, etc.

Thus, for this article, cross‑platform means

platform ≈ device

.

Java Implements Cross‑Platform

Java achieves cross‑platform support through its language specification, class files, and the Java Virtual Machine (JVM), which abstracts underlying OS and hardware differences.

Java source code is compiled into a unified class file, then the JVM either interprets the bytecode or JIT‑compiles frequently used methods to native code. HotSpot uses a hybrid mode combining interpretation and just‑in‑time compilation.

Interpretation: translate bytecode line‑by‑line into machine code.

JIT (Just‑in‑Time): compile entire methods containing hot bytecode into native code before execution.

Android Implements Cross‑Platform

Android, based on Java, follows a similar model but its runtime has evolved:

Android 1.0 (2008): Dalvik VM with an interpreter.

Android 2.2 (2010): Introduced JIT compilation.

Android 5.0 (2014): Replaced Dalvik with ART (Android Runtime), using Ahead‑of‑Time (AOT) compilation.

Android 7.0 (2016): Hybrid compilation – AOT at install time, JIT for hot code, balancing storage, install speed, and runtime performance.

Despite these improvements, Android apps are still packaged as Java code and undergo a final compilation step on the device.

Issues in Android Compilation

Android’s mixed compilation (interpretation + JIT + AOT) achieves a good balance of space usage, installation speed, and execution performance, but the necessity of device‑side compilation remains a performance bottleneck.

Harmony OS Implements Cross‑Platform

Harmony OS relies on the Ark Compiler and a multi‑device IDE. The Ark Compiler statically compiles high‑level languages (e.g., Java) directly to machine code, eliminating the need for a runtime VM.

The multi‑device IDE provides unified compilation, visual drag‑and‑drop UI components, and automatic layout adaptation for phones, watches, cars, TVs, and other smart devices, enabling “write once, run everywhere”.

Ark Compiler also introduces reference‑counting memory management with a cycle‑collector, avoiding the pause‑inducing garbage collection used by Android.

Future plans include extending the Ark Compiler to support multiple programming languages, allowing developers of various languages to create applications for Harmony OS.

References

https://www.jishuwen.com/d/2NN3 https://www.zhihu.com/question/339567108 https://www.cnbeta.com/articles/tech/876171.htm https://www.cnbeta.com/articles/tech/876919.htm https://juejin.im/post/5cb07000f265da037d4f9be6

JavaCross-PlatformAndroidArk CompilerHarmony OS
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.