Name Date Size #Lines LOC

..--

.github/H25-Apr-2025-8969

cxx/H25-Apr-2025-9,5445,957

docs/H25-Apr-2025-839720

gradle/wrapper/H25-Apr-2025-65

java/com/facebook/jni/H25-Apr-2025-644262

scripts/H25-Apr-2025-3612

test/H25-Apr-2025-6,4394,558

.gitignoreH A D25-Apr-2025129 86

Android.bpH A D25-Apr-2025962 4543

CMakeLists.txtH A D25-Apr-20253.7 KiB117101

CODE_OF_CONDUCT.mdH A D25-Apr-20253.3 KiB7857

CONTRIBUTING.mdH A D25-Apr-20251.2 KiB3124

LICENSEH A D25-Apr-202510.5 KiB191160

METADATAH A D25-Apr-2025652 1918

MODULE_LICENSE_APACHE2HD25-Apr-20250

OWNERSH A D25-Apr-202550 11

PREUPLOAD.cfgH A D25-Apr-202528 22

README.mdH A D25-Apr-20251.5 KiB4335

build.gradleH A D25-Apr-20252.3 KiB10084

googletest-CMakeLists.txt.inH A D25-Apr-2025620 2117

gradle.propertiesH A D25-Apr-20251.1 KiB3530

gradlewH A D25-Apr-20255.6 KiB186125

gradlew.batH A D25-Apr-20252.7 KiB9068

host.gradleH A D25-Apr-20251.5 KiB6254

settings.gradleH A D25-Apr-2025761 2623

README.md

1# fbjni
2
3The Facebook JNI helpers library is designed to simplify usage of the
4[Java Native Interface](https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/jniTOC.html).
5The helpers were implemented to ease the integration of cross-platform mobile
6code on Android, but there are no Android specifics in the design. It can be
7used with any Java VM that supports JNI.
8
9```cpp
10struct JMyClass : JavaClass<JMyClass> {
11  static constexpr auto kJavaDescriptor = "Lcom/example/MyClass;";
12
13  // Automatic inference of Java method descriptors.
14  static std::string concatenate(
15      alias_ref<JClass> clazz,
16      // Automatic conversion to std::string.
17      std::string prefix) {
18    // Call methods easily.
19    static const auto getSuffix = clazz->getStaticMethod<JString()>("getSuffix");
20    // Manage JNI references automatically.
21    local_ref<JString> jstr = getSuffix(clazz);
22    // Automatic exception translation between Java and C++ (both ways).
23    // No need to check exception state after each call.
24    result += jstr->toStdString();
25    // Automatic conversion from std::string.
26    return result;
27  }
28};
29```
30
31## Documentation
32
33- [Why use a JNI wrapper?](docs/rationale.md)
34- [Set up your Android build with fbjni](docs/android_setup.md)
35- [Quick reference to most features (great for copy/pasting!)](docs/quickref.md)
36- [Internal documentation for maintainers](docs/maintainers.md)
37<!-- TODO: tutorial -->
38<!-- TODO: Comparison with other frameworks. -->
39
40## License
41
42fbjni is Apache-2 licensed, as found in the [LICENSE](/LICENSE) file.
43