LN Code Editor
A modern, lightweight mobile code editor and portable IDE built for Android
简体中文 | English
📖 Introduction
LN Code Editor is a high-performance mobile code editor and pocket IDE crafted for Android. Fully optimized for touch-screen workflows, it features multi-language syntax highlighting, smart code completion and real-time diagnostics, a visual Git conflict resolver, and a rootless built-in Linux container with a full PTY shell, enabling developers to read, write, and debug code seamlessly on phones and tablets.
✨ Key Features
1. 📝 Professional Code Editing Experience
- Multi-Language Syntax Highlighting: Powered by
re_editorandre_highlightfor fast, accurate lexical coloring. - Smart Completion & Real-Time Diagnostics:
- Real-time auto-completion suggestions for variables, functions, and keywords.
- Inline wavy underlines for syntax errors and gutter indicators by line number.
- Master toggle + independent Completion / Diagnostics switches to fit both distraction-free reading and rapid coding.
- Pinch-to-Zoom & Typography: Smooth two-finger pinch zoom for font sizing, bundled with JetBrains Mono and Fira Code Nerd Fonts.
2. 🌿 Visual Git Conflict Resolver
- Automatic Conflict Detection: Detects all
<<<<<<<,=======, and>>>>>>>conflict blocks in a file. - Inline Diff Comparison: Highlights current and incoming changes clearly side by side.
- Quick Resolution Actions:
- Accept Current
- Accept Incoming
- Accept Both
- Manual Edit
- Mobile-Friendly Interaction: Overflow-safe horizontal scrolling and coordinated menu/drawer dismissal during conflict editing.
3. 🐧 Rootless Built-in Linux Container & Terminal
- Real Shell Environment: Wraps a lightweight Alpine Linux container via PRoot (and optional Chroot mode when Root is available) to provide native Linux CLI capabilities without requiring Root.
- Smooth Terminal Interaction: Built on a customized
xterm.dartandflutter_ptywith long-press and gesture text selection, crisp typography, and virtual shortcut keys. - Rich CLI Ecosystem: Run
git,apk,curl,python, and other standard Linux tools directly on Android.
4. 🎨 Swiss Minimalist Design
- Immersive dark theme designed to keep the focus on your code.
- High-contrast dual-tone Swiss minimalist icon with full Android 8.0+ Adaptive Icon support.
5. 🌐 Full Internationalization (l10n)
- Native support for Simplified Chinese (
zh) and English (en), following your system locale or manual selection.
🛠️ Tech Stack & Architecture
| Module | Stack | Description |
|---|---|---|
| Framework | Flutter 3.x / Dart 3.x | High-performance cross-platform rendering engine |
| Code Editor | re_editor / re_highlight |
High-performance mobile code editor and syntax highlighter |
| Terminal Emulator | xterm / flutter_pty |
Enhanced terminal selection and PTY pseudo-terminal bridge |
| Container Sandbox | PRoot + Alpine Linux / Shims | Native C/C++ cross-architecture compatibility layer & runtime |
| App Icons | flutter_launcher_icons |
Automated generation of Android mipmaps and adaptive icons |
| State & Storage | provider / shared_preferences |
Reactive state management and persistent preferences |
🚀 Installation & Build
Option 1: Install Release APK Directly (Recommended)
Download the release APK from the Gitea Releases page (or check releases/):
LN-Code-Editor-<version>-universal.apk(Universal all-in-one APK)LN-Code-Editor-<version>-arm64-v8a.apk(Recommended for most modern ARM64 phones)LN-Code-Editor-<version>-armeabi-v7a.apk(For legacy 32-bit ARM devices)LN-Code-Editor-<version>-x86_64.apk(For Android emulators, WSA, or ChromeOS)
Option 2: Build from Source
1. Prerequisites
- Flutter SDK (
>= 3.24.0) - Android SDK (API 34) & NDK (
28.2.13676358) - JDK 11 or 17
2. Fetch Dependencies & Run
# Install dependencies
flutter pub get
# Run on a connected Android device or emulator
flutter run
3. Build Release APKs
Build a universal release APK:
flutter build apk --release
Or use the included PowerShell script to build all ABI splits + universal APK into releases/:
# Windows PowerShell
.\tools\build\build-release-apks.ps1
📁 Project Structure
├── android/ # Android native config, JNI libraries, and MethodChannel bridge
├── assets/ # Bundled fonts (JetBrains/Fira), Linux rootfs, icons, and shims
│ ├── fonts/ # Nerd Font monospace programming fonts
│ ├── icon/ # High-resolution adaptive app icons
│ └── shims/ # Container architecture compatibility shims
├── lib/ # Flutter / Dart application source code
│ ├── l10n/ # Localization ARB files (zh / en)
│ ├── models/ # Core data models (Git conflicts, file trees, etc.)
│ ├── providers/ # State management (settings, workspace, terminal, tabs)
│ ├── services/ # Native & container services (Linux distro, updater, Git, LSP)
│ ├── views/ # Core screens (main editor, settings, completion, conflicts)
│ └── widgets/ # Reusable UI widgets (editor, Git conflict panel, file tree)
├── packages/ # Customized & patched third-party packages (re_editor, xterm)
├── tools/ # Build and utility scripts (build-release-apks.ps1, etc.)
└── test/ # Unit tests and widget tests
🧪 Automated Testing
Run the test suite:
flutter test
📄 License
This project is open-sourced under the GNU General Public License v3.0 (GPL-3.0).