xref: /aosp_15_r20/art/libnativebridge/README.md (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker# Native Bridge
2*795d594fSAndroid Build Coastguard Worker
3*795d594fSAndroid Build Coastguard WorkerA native bridge enables apps with native components to run on systems with
4*795d594fSAndroid Build Coastguard Workerdifferent ISA or ABI.
5*795d594fSAndroid Build Coastguard Worker
6*795d594fSAndroid Build Coastguard WorkerFor example, an application which has only native ARM binaries may run on an x86
7*795d594fSAndroid Build Coastguard Workersystem if there’s a native bridge installed which can translate ARM to x86. This
8*795d594fSAndroid Build Coastguard Workeris useful to bootstrap devices with an architecture that is not supported by the
9*795d594fSAndroid Build Coastguard Workermajority of native apps in the app store (it closes the gap between the number
10*795d594fSAndroid Build Coastguard Workerof apps that can be run on that particular architecture).
11*795d594fSAndroid Build Coastguard Worker
12*795d594fSAndroid Build Coastguard WorkerStarting from L, AOSP supports native bridges (note that it *does not* provide
13*795d594fSAndroid Build Coastguard Workeran actual native bridge).
14*795d594fSAndroid Build Coastguard Worker
15*795d594fSAndroid Build Coastguard WorkerThe `libnativebridge` library handles loading of native libraries with a foreign
16*795d594fSAndroid Build Coastguard WorkerISA (aka *translated* libraries in the *guest* environment) into a managed JVM
17*795d594fSAndroid Build Coastguard Workerprocess using the native ISA in the *host* environment. Note that loading
18*795d594fSAndroid Build Coastguard Workertranslated libraries and their dependencies in the guest environment is done by
19*795d594fSAndroid Build Coastguard Workera separate linker, which typically uses a different linker config than the host
20*795d594fSAndroid Build Coastguard Workerone.
21*795d594fSAndroid Build Coastguard Worker
22*795d594fSAndroid Build Coastguard Worker![Zygote/app startup integration diagram](nb-diagram.png)
23*795d594fSAndroid Build Coastguard Worker
24*795d594fSAndroid Build Coastguard WorkerSee also [design doc](http://go/native-bridge) (internal only).
25