505,000 Chinese characters, 3 MB APK: shipping a classical text as an offline reader
I have been writing a commentary on the Yijing (Book of Changes) for a while. It ended up at 72 sections, 505,000 non-whitespace Chinese characters, and 704 A4 pages. At that point the interesting question stopped being "what does it say" and became "how does somebody actually read the thing" — on a phone, on a train, with no network. This post is the build log: one Markdown source, four…
A commentary on the Yijing (Book of Changes) has been expanded from 72 sections to 505,000 non-whitespace Chinese characters, resulting in 704 A4 pages. The challenge shifted from understanding its content to figuring out how to make it accessible on a phone without an internet connection.
The project consists of one source Markdown file, four deliverables, and several issues encountered during the process. The repository contains the code, and a reading site allows users to access the content online.
The original reading page initially relied on a webfont from a CDN, which proved ineffective without an internet connection. To address this, the build process inlines a subset of the font, reducing the size from 20 MB to 2.5 MB for two weights. Additionally, every codepoint used in the text is extracted rather than relying on a generic CJK font, ensuring that symbols like hexagrams and trigrams are displayed correctly.
The APK development required using Android Studio but ultimately avoided it by utilizing a WebView shell. Six steps were followed to create the APK: aapt2 compile, res.zip aapt2 link, resources, R.java generation, assets addition, and manifest creation. The APK is then processed through javac, d8, and zipalign before being signed with apksigner. Careful attention is paid to avoid missing platform packages and to set appropriate permissions, ensuring the app can run in airplane mode without leaking data.
To improve discoverability, the site is split into 70 pages, each representing a hexagram, with a unique URL, description, and links to the next and previous entries. This structure makes it easier for search engines to index the content and for users to navigate through the entire work. The project is released under CC BY-NC-SA 4.0, allowing others to share and adapt the content non-commercially, while giving appropriate credit to the original work.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.