Repository navigation
Android
This guide covers setting up an Android Blinc project — toolchain, build commands, and the platform-specific files (AndroidManifest.xml, Gradle config, debugging).
For the cross-platform Blinc API (native bridge, camera, deep linking, lifecycle, etc.), see the Mobile Development overview.
# macOS
brew install --cask android-studio
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/26.1.10909125
export PATH=$PATH:$ANDROID_HOME/platform-toolsrustup target add aarch64-linux-android
rustup target add armv7-linux-androideabi
rustup target add x86_64-linux-android
cargo install cargo-ndk# Debug — single arch
cargo ndk -t arm64-v8a build
# Release — multi-arch
cargo ndk -t arm64-v8a -t armeabi-v7a build --release
# Or via Gradle (from platforms/android/)
./gradlew assembleDebugThe APK lands in app/build/outputs/apk/debug/app-debug.apk.
[lib]
name = "my_app"
crate-type = ["cdylib", "staticlib"]
[target.'cfg(target_os = "android")'.dependencies]
blinc_app = { version = "0.5", features = ["android"] }
blinc_platform_android = "0.5"
android-activity = { version = "0.6", features = ["native-activity"] }
log = "0.4"
android_logger = "0.14"<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
<!-- Permissions for native bridge features -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="My App"
android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
android:hardwareAccelerated="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboardHidden|keyboard|navigation|uiMode|density|colorMode|fontScale|locale|layoutDirection|touchscreen|mcc|mnc"
android:exported="true">
<meta-data
android:name="android.app.lib_name"
android:value="my_app" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Deep link: myapp://path/to/route -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
</activity>
</application>
</manifest>Critical — do not trim
launchModeorconfigChanges. Blinc runs on aNativeActivity, whose native context (ndk-context) can only be initialized once per process. If Android destroys and recreates the activity (a config change the manifest doesn't declare, or a launcher-icon resume that spawns a second activity instance), the second init hitsassert!(previous.is_none())and the process aborts (SIGABRT) — Android then cold-restarts the app, which the user sees as "resume flashes black and comes back with fresh state."launchMode="singleTask"makes an icon tap resume the single instance instead of creating a new one, and the broadconfigChangeslist keeps config changes (dark mode, density, font scale, insets, …) from destroying the activity. Both are required, not optional.
# View Rust logs
adb logcat | grep -E "(blinc|BlincApp)"
# Filter for native bridge calls
adb logcat | grep BlincNativeBridge"Library not found" — ensure the native library is built and copied to app/src/main/jniLibs/<arch>/:
cargo ndk -t arm64-v8a build
cp target/aarch64-linux-android/debug/libmy_app.so \
platforms/android/app/src/main/jniLibs/arm64-v8a/"Vulkan not supported" — check device capability:
adb shell getprop ro.hardware.vulkanAPI 24+ devices generally support Vulkan, but some emulators may not.
"Native call failed" — verify the namespace+name matches between Kotlin and Rust handlers. Check logcat for BlincNativeBridge: handler not found for X.Y.
Touch events not working — verify the render context is created successfully and android.app.lib_name in the manifest matches your library name.
[profile.release]
lto = "fat"
opt-level = "z" # optimize for size on mobile
panic = "abort"
strip = true
codegen-units = 1- Test on real devices — emulators have different GPU characteristics
- Profile with Android Studio Profiler for CPU/GPU/memory
-
Bundle assets via
assets/—AndroidAssetLoaderauto-resolves them through the platformAssetLoadertrait
- Mobile Development overview — native bridge, camera, deep linking, lifecycle, safe area APIs
- iOS Project Setup — build the iOS counterpart
- CLI Reference
Getting Started
Mobile Development
Example Gallery
- Example Gallery
- Canvas Element
- Canvas Kit Interactive
- Carousel Demo - Selector API Showcase
- Chrome-Style Tabs
- blinc_cn Components
- Code Element
- Complex SVG
- CSS Debug
- CSS Visual Features
- Layer Effects
- Emoji and HTML Entities
- @flow Shader
- Fluid Surface
- Skeleton animation with glTF +
blinc_canvas_kit. DrawContext::run_gpu_passend-to-end demo.- Image CSS Styling
- Image Layer Test
- Keyframe Animation Canvas
- Markdown Editor
- 3D Mesh Demo — renders the Khronos glTF
DamagedHelmetsample model - Motion Demo
- Music Player Glass Card
- Node-editor demo — pre-wired graph with three node types, typed
- Notch Menu Bar
- Overflow Fade
- Overlay System
- Pointer Query
- Rich Text Element
- Rich Text Editor
- Scroll Container
- Semantic @flow
- Sortable
- Stateful API + Signal-bound modifiers demo.
- End-to-end 3D demo wiring Blinc's SceneKit3D renderer up to
- Unified Styling API
- SVG Animation
- Table Builder
- Tabler Icons
- Minimal text positioning test
- Text Input Widgets
- KHR_texture_transform
- Theme System
- Timeline Animation
- Typography
- Video Player
- Wet Glass
- Windowed Application
Web Development
Core Concepts
- Elements & Layout
- Styling & Materials
- CSS Styling
- Theming
- Event Handling
- State Management
- Element Refs
Animation
Components
Component Library (blinc_cn)
Widgets
- Buttons & Inputs
- Text & Rich Text
- Code Editor
- Scroll Containers
- Virtualized List
- Canvas Drawing
- Images & SVG
- Audio & Video
- Markdown Rendering
Canvas Kit
Advanced
- Routing & Navigation
- Multi-Window
- System Integration
- Element Query API
- Overlay System
- Custom State Machines
- Pointer Query
- Performance Tips
- Flow Shaders
- 3D Rendering
- Custom GPU Passes
- Hot-reload (experimental)
Architecture
Contributing