Skip to content

feat: Add Android app with JNI bridge#266

Draft
eval-exec wants to merge 5 commits intonervosnetwork:developfrom
eval-exec:exec/android-new
Draft

feat: Add Android app with JNI bridge#266
eval-exec wants to merge 5 commits intonervosnetwork:developfrom
eval-exec:exec/android-new

Conversation

@eval-exec
Copy link
Contributor

@eval-exec eval-exec commented Jan 5, 2026

Summary

Adds a native Android app for CKB Light Client with direct JNI integration.

Build & Install

  make android-package        # Build APK
  make android-install        # Install to device
image

@eval-exec eval-exec marked this pull request as ready for review January 5, 2026 14:13
@eval-exec eval-exec changed the title Android feat: Add Android app with JNI bridge Jan 5, 2026
@eval-exec eval-exec force-pushed the exec/android-new branch 2 times, most recently from cece863 to 12854a8 Compare January 6, 2026 15:29
@eval-exec
Copy link
Contributor Author

I built an apk by make android-package: https://drive.google.com/file/d/1nakI7Wo1Oc1cnUng1zl6Kms-NLKVsqfc/view?usp=sharing

@eval-exec eval-exec marked this pull request as draft January 16, 2026 04:38
Signed-off-by: Eval EXEC <execvy@gmail.com>
Remove duplicated RPC implementation (light-client-lib/src/rpc.rs, 1112 lines)
and rewrite JNI bridge to use the service layer from PR nervosnetwork#270.

- Delete rpc.rs that duplicated all business logic from service/impls.rs
- Rewrite jni_bridge/rpc_handler.rs to delegate to LightClientChainService
  and LightClientNetworkService instead of manually building responses
- Rewrite jni_bridge/query.rs to use service layer, implementing all
  previously TODO methods (get_cells, get_transactions, get_cells_capacity,
  send_transaction, get_transaction, fetch_transaction, estimate_cycles)
- Add service factory functions to jni_bridge/types.rs
Replace OnceLock with Mutex<Option<T>> for session-lifetime globals
(StorageWithChainData, NetworkController, Consensus, Peers, Runtime,
StatusCallback) so they can be cleared on stop and re-set on init.

JAVA_VM stays as OnceLock since it's process-lifetime (one JVM per process).

nativeStop() now calls reset_session_state() to clear all session state
and reset to STATE_INIT, allowing nativeInit() to be called again
without killing the process.

Also remove global RocksDB env vars from .cargo/config.toml that were
incorrectly affecting all targets (desktop included). These vars are
already set correctly in the Android build scripts.
All Android cross-compilation settings (linker, ar, RocksDB flags) are
configured via environment variables in the build scripts. This file
had no effective configuration left.
- Extract NDK discovery, platform detection, cross-compilation env,
  RocksDB flags, and stubs compilation into android-env.sh
- Simplify build-android-jni.sh to source android-env.sh
- Delete build-android.sh (standalone binary build, unused by Makefile)
- Add darwin-arm64 support for Apple Silicon hosts
- Remove hardcoded /home/exec/... NDK path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants