feat: Add Android app with JNI bridge#266
Draft
eval-exec wants to merge 5 commits intonervosnetwork:developfrom
Draft
feat: Add Android app with JNI bridge#266eval-exec wants to merge 5 commits intonervosnetwork:developfrom
eval-exec wants to merge 5 commits intonervosnetwork:developfrom
Conversation
a4346f2 to
0dc881b
Compare
chenyukang
reviewed
Jan 5, 2026
cece863 to
12854a8
Compare
Contributor
Author
|
I built an apk by make android-package: https://drive.google.com/file/d/1nakI7Wo1Oc1cnUng1zl6Kms-NLKVsqfc/view?usp=sharing |
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
12854a8 to
92ce7a1
Compare
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a native Android app for CKB Light Client with direct JNI integration.
Build & Install