Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hsfzxjy/android-jni-go
https://github.com/hsfzxjy/android-jni-go
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hsfzxjy/android-jni-go
- Owner: hsfzxjy
- License: apache-2.0
- Created: 2022-07-06T05:58:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-22T09:01:30.000Z (over 2 years ago)
- Last Synced: 2023-08-01T08:43:53.986Z (over 1 year ago)
- Language: Go
- Size: 21.5 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# android-jni-go (ajni)
This library contains types and functions for interoperating Go and JVM on Android.
Most of the code is ported from [xlab/android-go](https://github.com/xlab/android-go), which seems not being maintained for a quite a while. This library extracts a small portion from android-go's auto-generated code, and fixes several critical issues.
## Differences from xlab/android-go
**This library contains only JNI interfaces.** Instead, xlab/android-go is a self-contained project to create Android app using Go.
**This library uses `uintptr` as underlying representation of JNI reference types,** while xlab/android-go uses `unsafe.Pointer`. The latter could be bugged when, for example, a JNI function returns a local ref. The address value of local ref is usually small (`<= 0xFF`) and could fail Go's pointer checking when goruntime moves the stack.
It's also worth noted that xlab/android-go uses `*JbyteArray` to represent a JVM reference type, while in this library we use simply `JbyteArray`. Apart from the difference, this library can be used as a drop-in replacement for xlab/android-go.