ndk
Safe Rust bindings to the Android NDK
0.9.0
49M downloads/mo
#1240 most downloaded on crates.io
rust-mobile/ndk
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 5 weeks to 13 months
Nearly every release is documented
notes for 10 of 10 stable releases
1 version withdrawn
withdrawn after publishing
6 years old
12 releases · first in 2020
0 releases in the last 12 months
see the full history below
Release timeline
12 releases · Apr 2020 to Apr 2024
2021
2022
2023
2024
2025
2026
Releases
latest 12-
0.9.026 Apr 2024Release notes
Open source →- Move
MediaFormatfrommedia::media_codecto its ownmedia::media_formatmodule. (#442) - media_format: Expose
MediaFormat::copy()andMediaFormat::clear()from API level 29. (#449) - Breaking: media_format: Mark all
fn set_*()andfn str()as takingselfby&mut. (#452) - Breaking: Require all
dyn Fn*types to implementSendwhen the FFI implementation invokes them on a separate thread: (#455)audio::AudioStreamDataCallback;audio::AudioStreamErrorCallback;media::image_reader::BufferRemovedListener;media::image_reader::ImageListener;media::media_codec::ErrorCallback;media::media_codec::FormatChangedCallback;media::media_codec::InputAvailableCallback;media::media_codec::OutputAvailableCallback.
- Drop previous
Boxed callbacks after registering new ones, instead of before. (#455) - input_queue: Add
from_java()constructor, available since API level 33. (#456) - event: Add
from_java()constructors toKeyEventandMotionEvent, available since API level 31. (#456) - Breaking: image_reader: Special-case return statuses in
Image-acquire functions. (#457) - Breaking: image_reader: Mark
ImageReader::acquire_latest_image_async()unsafeto match the safety requirements onImageReader::acquire_next_image_async(). (#457) - event: Implement
SourceClassbitflagand provideSource::class()getter. (#458) - Ensure all
bitflagsimplementations consider all (including unknown) bits in negation andall(). (#458) - Breaking: Mark all enums as
non_exhaustiveand fixreprtypes. (#459) - Breaking: native_window: Remove redundant
TRANSFORM_prefix fromNativeWindowTransformvariants. (#460) - Breaking: hardware_buffer: Convert
HardwareBufferUsagetobitflags. (#461) - bitmap: Guard
BitmapCompressErrorbehind missingapi-level-30feature. (#462) - native_window: Require linking against
libnativewindowfor most API >= 26 functions. (#465) - Breaking: audio: Merge
AudioResultvariant enum intoAudioError. (#467) - data_space: Add missing
DataSpaceRange::Unspecifiedvariant. (#468) - Breaking: looper: Require
Sendmarker when adding fd event callbacks onForeignLooper. (#469) - Breaking: Upgrade to
ndk-sys 0.6.0. (#472)
Release notes
Open source →- Move
MediaFormatfrommedia::media_codecto its ownmedia::media_formatmodule. (#442) - media_format: Expose
MediaFormat::copy()andMediaFormat::clear()from API level 29. (#449) - Breaking: media_format: Mark all
fn set_*()andfn str()as takingselfby&mut. (#452) - Breaking: Require all
dyn Fn*types to implementSendwhen the FFI implementation invokes them on a separate thread: (#455)audio::AudioStreamDataCallback;audio::AudioStreamErrorCallback;media::image_reader::BufferRemovedListener;media::image_reader::ImageListener;media::media_codec::ErrorCallback;media::media_codec::FormatChangedCallback;media::media_codec::InputAvailableCallback;media::media_codec::OutputAvailableCallback.
- Drop previous
Boxed callbacks after registering new ones, instead of before. (#455) - input_queue: Add
from_java()constructor, available since API level 33. (#456) - event: Add
from_java()constructors toKeyEventandMotionEvent, available since API level 31. (#456) - Breaking: image_reader: Special-case return statuses in
Image-acquire functions. (#457) - Breaking: image_reader: Mark
ImageReader::acquire_latest_image_async()unsafeto match the safety requirements onImageReader::acquire_next_image_async(). (#457) - event: Implement
SourceClassbitflagand provideSource::class()getter. (#458) - Ensure all
bitflagsimplementations consider all (including unknown) bits in negation andall(). (#458) - Breaking: Mark all enums as
non_exhaustiveand fixreprtypes. (#459) - Breaking: native_window: Remove redundant
TRANSFORM_prefix fromNativeWindowTransformvariants. (#460) - Breaking: hardware_buffer: Convert
HardwareBufferUsagetobitflags. (#461) - bitmap: Guard
BitmapCompressErrorbehind missingapi-level-30feature. (#462) - native_window: Require linking against
libnativewindowfor most API >= 26 functions. (#465) - Breaking: audio: Merge
AudioResultvariant enum intoAudioError. (#467) - data_space: Add missing
DataSpaceRange::Unspecifiedvariant. (#468) - Breaking: looper: Require
Sendmarker when adding fd event callbacks onForeignLooper. (#469) - Breaking: Upgrade to
ndk-sys 0.6.0. (#472)
- Move
-
0.8.014 Oct 2023Release notes
Open source →- event: Add
tool_typegetter forPointer. (#323) - input_queue: Allow any non-zero return code from
pre_dispatch()again, as per documentation. (#325) - asset: Use entire asset length when mapping buffer. (#387)
- Bump MSRV to 1.66 for
raw-window-handle 0.5.1,num_enum'scatch_allwith arbitrary enum discriminants. (#388, #431) - Bump optional
jnidependency for doctest example from0.19to0.21. (#390) - Breaking: Upgrade to
ndk-sys 0.5.0. (#370) - Breaking: Upgrade
bitflagscrate from1to2. (#394) - bitmap: Add
try_format()toAndroidBitmapInfoto handle unexpected formats without panicking. (#395) - Add
Fontbindings. (#397) - Breaking: Upgrade
num_enumcrate from0.5.1to0.7. (#398, #419) - Breaking: Renamed, moved and flattened "
media" error types and helpers to a newmedia_errormodule. (#399, #432) - Breaking: media_codec: Wrap common dequeued-buffer status codes in enum. (#401)
- Breaking: media_codec: Return
MaybeUninitbytes inbuffer_mut(). (#403) - native_window: Add
lock()to blit raw pixel data. (#404) - hardware_buffer_format: Add
YCbCr_P010andR8_UNORMvariants. (#405) - Breaking: hardware_buffer_format: Add catch-all variant. (#407)
- asset: Add missing
is_allocated()andopen_file_descriptor()methods. (#409) - Breaking: media_codec: Add support for asynchronous notification callbacks. (#410)
- Add panic guards to callbacks. (#412)
- looper: Add
remove_fd()to unregister events/callbacks for a file descriptor. (#416) - Breaking: Use
BorrowedFdandOwnedFdto clarify possible ownership transitions. (#417) - Breaking: Upgrade to
ndk-sys 0.5.0. (#420) - Add bindings for
sync.h. (#423) - Breaking: bitmap: Provide detailed implementation for
AndroidBitmapInfoFlags. (#424) - native_window: Add
set_buffers_transform(),try_allocate_buffers()andset_frame_rate*(). (#425) - Add bindings for
ASharedMemory. (#427) - hardware_buffer: Add
id()to retrieve a system-wide unique identifier for aHardwareBuffer. (#428) - Breaking: bitmap: Strip
Androidprefix from structs and enums, andBitmapfromResult. (#430) - Breaking:
raw-window-handle 0.5support is now behind an optionalrwh_05crate feature andraw-window-handle0.4and0.6support is provided via the newrwh_04and (default-enabled)rwh_06crate features. (#434) - Breaking: looper: Provide
eventvalue to file descriptor poll callback. (#435) - Breaking:
HardwareBufferFormatis no longer exported fromhardware_bufferandnative_window, and can only be reached through thehardware_buffer_formatmodule. (#436) - Breaking:
get_prefixes have been removed from all public functions in light of the C-GETTER convention. (#437) - Add
DataSpacetype and relevant functions onBitmapandNativeWindow. (#438) - bitmap: Add
Bitmap::compress()andBitmap::compress_raw()functions. (#440) - Breaking: Turn
BitmapErrorinto anon_exhaustiveenum. (#440) - Breaking: audio: Rename
AudioErrorResulttoAudioResultand turn into anon_exhaustiveenum. (#441)
Release notes
Open source →- event: Add
tool_typegetter forPointer. (#323) - input_queue: Allow any non-zero return code from
pre_dispatch()again, as per documentation. (#325) - asset: Use entire asset length when mapping buffer. (#387)
- Bump MSRV to 1.64 for
raw-window-handle 0.5.1. (#388) - Bump optional
jnidependency for doctest example from0.19to0.21. (#390) - Breaking: Upgrade to
ndk-sys 0.5.0. (#370) - Breaking: Upgrade
bitflagscrate from1to2. (#394) - bitmap: Add
try_format()toAndroidBitmapInfoto handle unexpected formats without panicking. (#395) - Breaking: Upgrade
num_enumcrate from0.5.1to0.7. (#398, #419) - Breaking: Renamed and moved "
media" error types and helpers to a newmedia_errormodule. (#399) - Breaking: media_codec: Wrap common dequeued-buffer status codes in enum. (#401)
- Breaking: media_codec: Return
MaybeUninitbytes inbuffer_mut(). (#403) - native_window: Add
lock()to blit raw pixel data. (#404) - hardware_buffer_format: Add
YCbCr_P010andR8_UNORMvariants. (#405) - Breaking: hardware_buffer_format: Add catch-all variant. (#407)
- Breaking: media_codec: Add support for asynchronous notification callbacks. (#410)
- Add panic guards to callbacks. (#412)
- looper: Add
remove_fd()to unregister events/callbacks for a file descriptor. (#416) - Breaking: Use
BorrowedFdandOwnedFdto clarify possible ownership transitions. (#417) - Breaking: Upgrade to
ndk-sys 0.5.0. (#420)
Release notes
Open source →- Breaking: Postpone APK library packaging until before zip alignment, to deduplicate possibly overlapping entries. (#333)
- Add
adbdevice serial parameter todetect_abi()andApk::{install,start}(). (#329) - Fix missing
.exeextension foradbon Windows insidedetect_abi(). (#339) start()now returns the PID of the started app process (useful for passing toadb logcat --pid). (#331)- Inherit
ndk_gdb()function fromcargo-apkwith the appropriate script extension across platforms. (#330, #258) - Provide
adbpath tondk-gdb, allowing it to run withoutadbinPATH. (#343) - Remove quotes from
Android.mkto fixndk-gdbon Windows. (#344) - Launch Android activity through
ndk-gdbto block app start until the debugger is attached. (#345) - Consider
ANDROID_SDK_ROOTas deprecated instead ofANDROID_HOME. (#346) - Breaking: Rename
fn android_dir()tofn android_user_home()and seed withANDROID_SDK_HOMEorANDROID_USER_HOME. (#347)
Release notes
Open source →- event: Add
tool_typegetter forPointer. (#323) - input_queue: Allow any non-zero return code from
pre_dispatch()again, as per documentation. (#325) - asset: Use entire asset length when mapping buffer. (#387)
- Bump MSRV to 1.66 for
raw-window-handle 0.5.1,num_enum'scatch_allwith arbitrary enum discriminants. (#388, #431) - Bump optional
jnidependency for doctest example from0.19to0.21. (#390) - Breaking: Upgrade to
ndk-sys 0.5.0. (#370) - Breaking: Upgrade
bitflagscrate from1to2. (#394) - bitmap: Add
try_format()toAndroidBitmapInfoto handle unexpected formats without panicking. (#395) - Add
Fontbindings. (#397) - Breaking: Upgrade
num_enumcrate from0.5.1to0.7. (#398, #419) - Breaking: Renamed, moved and flattened "
media" error types and helpers to a newmedia_errormodule. (#399, #432) - Breaking: media_codec: Wrap common dequeued-buffer status codes in enum. (#401)
- Breaking: media_codec: Return
MaybeUninitbytes inbuffer_mut(). (#403) - native_window: Add
lock()to blit raw pixel data. (#404) - hardware_buffer_format: Add
YCbCr_P010andR8_UNORMvariants. (#405) - Breaking: hardware_buffer_format: Add catch-all variant. (#407)
- asset: Add missing
is_allocated()andopen_file_descriptor()methods. (#409) - Breaking: media_codec: Add support for asynchronous notification callbacks. (#410)
- Add panic guards to callbacks. (#412)
- looper: Add
remove_fd()to unregister events/callbacks for a file descriptor. (#416) - Breaking: Use
BorrowedFdandOwnedFdto clarify possible ownership transitions. (#417) - Breaking: Upgrade to
ndk-sys 0.5.0. (#420) - Add bindings for
sync.h. (#423) - Breaking: bitmap: Provide detailed implementation for
AndroidBitmapInfoFlags. (#424) - native_window: Add
set_buffers_transform(),try_allocate_buffers()andset_frame_rate*(). (#425) - Add bindings for
ASharedMemory. (#427) - hardware_buffer: Add
id()to retrieve a system-wide unique identifier for aHardwareBuffer. (#428) - Breaking: bitmap: Strip
Androidprefix from structs and enums, andBitmapfromResult. (#430) - Breaking:
raw-window-handle 0.5support is now behind an optionalrwh_05crate feature andraw-window-handle0.4and0.6support is provided via the newrwh_04and (default-enabled)rwh_06crate features. (#434) - Breaking: looper: Provide
eventvalue to file descriptor poll callback. (#435) - Breaking:
HardwareBufferFormatis no longer exported fromhardware_bufferandnative_window, and can only be reached through thehardware_buffer_formatmodule. (#436) - Breaking:
get_prefixes have been removed from all public functions in light of the C-GETTER convention. (#437) - Add
DataSpacetype and relevant functions onBitmapandNativeWindow. (#438) - bitmap: Add
Bitmap::compress()andBitmap::compress_raw()functions. (#440) - Breaking: Turn
BitmapErrorinto anon_exhaustiveenum. (#440) - Breaking: audio: Rename
AudioErrorResulttoAudioResultand turn into anon_exhaustiveenum. (#441)
- event: Add
-
0.8.0-beta.015 Aug 2023 pre-releaseNothing published for this version
-
0.7.024 Jul 2022Release notes
Open source →- hardware_buffer: Make
HardwareBuffer::as_ptr()public for interop with Vulkan. (#213) - Breaking:
Configuration::country()now returnsNonewhen the country is unset (akin toConfiguration::language()). (#220) - Add
MediaCodecandMediaFormatbindings. (#216) - Breaking: Upgrade to
ndk-sys 0.4.0and use newenumnewtype wrappers. (#245) - native_window: Use
release/acquireforDropandClonerespectively. (#207) - Breaking: audio: Rename from
aaudiotoaudioand dropAprefix. (#273) - Implement
HasRawWindowHandledirectly onNativeWindow. (#274, #319) - Breaking: native_activity: Replace
CStrreturn types withPath. (#279) - native_window: Add
format()getter andset_buffers_geometry()setter. (#276) - native_activity: Add
set_window_format()setter. (#277) - native_activity: Add
set_window_flags()to change window behavior. (#278) - Add
SurfaceTexturebindings. (#267) - Improve library and structure documentation, linking back to the NDK docs more rigorously. (#290)
- Breaking: input_queue:
get_event()now returns aResultwithstd::io::Error;InputQueueErrorhas been removed. (#292) - Breaking: input_queue:
has_events()now returns abooldirectly without being wrapped inResult. (#294) - Breaking: hardware_buffer:
HardwareBufferErrorhas been removed and replaced withstd::io::Errorin return types. (#295) - Fixed
HardwareBufferleak on buffers returned fromAndroidBitmap::get_hardware_buffer(). (#296) - Bump optional
jnidependency for doctest example from0.18to0.19. (#300) - hardware_buffer: Made
HardwareBufferDescfieldspub. (#313) - Breaking: Remove
hardware_bufferandtracefeatures in favour of usingapi-level-26orapi-level-23directly. (#320)
- hardware_buffer: Make
-
0.6.005 Jan 2022Release notes
Open source →- Breaking: Upgrade to
ndk-sys 0.3.0and migrate tojni-systypes that it now directly uses in its bindings. (#209 / #214)
- Breaking: Upgrade to
-
0.5.022 Nov 2021Release notes
Open source →Release notes
Open source →- Breaking: Replace
add_fd_with_callbackidentwith constant valueALOOPER_POLL_CALLBACK, as per https://developer.android.com/ndk/reference/group/looper#alooper_addfd. - Breaking: Accept unboxed closure in
add_fd_with_callback. - aaudio: Replace "Added in" comments with missing
#[cfg(feature)]. - aaudio: Add missing
fn get_allowed_capture_policy(). - configuration: Add missing
api-level-30feature tofn screen_round().
- Breaking: Replace
-
0.4.003 Aug 2021 -
0.3.030 Jan 2021Release notes
Open source →- Breaking: Looper
identnot passed indatapointer anymore.attach_loopernow only sets theidentfield when attaching anInputQueueto aForeignLooper. If you are relying onPoll::Event::datato tell event fd and input queue apart, please usePoll::Event::identand the new constants introduced inndk-glue!
- Breaking: Looper
-
0.2.119 Oct 2020 -
0.2.015 Sep 2020Release notes
Open source →- Breaking: Updated to use ndk-sys 0.2.0
- Added
mediabindings - Added
bitmapandhardware_bufferbindings - Added
aaudiobindings - Fixed assets directory path to be relative to the manifest
- Added
tracefeature for native tracing
-
0.1.129 Jul 2020 withdrawnNothing published for this version
-
0.1.022 Apr 2020