Skip to content

v2.4.1

Latest

Choose a tag to compare

@lingol lingol released this 30 Jul 08:20
6ad828c

v2.4.1 / 2026-07-30

This is a maintenance release based on v2.4.0. It focuses on data-safety fixes, encrypted-file compatibility, packaging/build cleanup, and experimental Kotlin Multiplatform support for Android and iOS.

Changes for All Platforms

  • Fix: Improved MMKV instance lifecycle handling with safer wrapper ownership, native lock teardown, and clarified destructive close() semantics.
  • Fix: Fixed an oversized-key corruption bug where keys longer than the internal uint16_t holder limit could overflow key/value metadata and corrupt subsequent reads.
  • Fix: Fixed an expireDuration overflow bug (#1665). Very large expiration durations are now clamped safely instead of wrapping around.
  • Fix: Improved encrypted MMKV random-IV upgrade behavior. Existing encrypted files using the older IV format now trigger a full writeback when possible so they are upgraded to the random-IV format.
  • Fix: Added safer random-IV reset behavior when clearing memory cache for encrypted instances.
  • Fix: Fixed -Wmissing-braces warnings in Android, Win32, and POSIX demo code.
  • Change: Added extra mmap/munmap logging to help diagnose file mapping lifecycle issues.
  • Feature: Added a universal C interface (Core/cbridge) for MMKV Core, with NameSpace support and a pure C demo. The C bridge is also used by the KMP iOS package.

Kotlin Multiplatform

  • Experimental: Added Kotlin Multiplatform support for Android and iOS via the Gradle package com.tencent:mmkv-kmp:2.4.1. The API and artifact layout may change in a future release.
  • Supported targets: Android, iosArm64, iosSimulatorArm64, and iosX64.
  • Android delegates to the native com.tencent:mmkv:2.4.1 AAR. iOS embeds MMKV Core through the C bridge in the published native KLIBs.
  • Fix: Added platform-parity buffer/state APIs, preserved empty byte arrays on iOS, respected handler notification preferences, and added Android device plus Kotlin/Native smoke tests.
  • Fix: Improved MMKV instance lifecycle handling and clarified destructive close() semantics.

Android

  • Fix: Added regression coverage for the expiration overflow issue.
  • Fix: Improved Android CMake header-export detection for builds where ANDROID_ABI is defined, including local Android artifact publication builds.

iOS/macOS

  • Feature: Added the static SwiftPM product MMKVAppExtension-static.
  • Fix: Excluded the standalone C bridge from the Objective-C++ SwiftPM Core target and gave each wrapper target its own privacy manifest resource.
  • Feature: Added +[MMKV unregisterHandler] as the correctly spelled handler-unregistration API. The previous typo'd +unregiserHandler remains available for source/binary compatibility and forwards to the new API.

HarmonyOS NEXT

  • Change: Cleaned up project signing/build configuration and removed checked-in Hvigor dependency archives.
  • Fix: Improved MMKV instance lifecycle handling and clarified destructive close() semantics.
  • Change: Prepared the @tencent/mmkv package metadata and documentation for v2.4.1.

Flutter

  • Feature: Added Swift Package Manager support for the Apple platform implementation and migrated the iOS/macOS examples to SwiftPM. CocoaPods remains available as a fallback.
  • Fix: Improved MMKV instance lifecycle handling and clarified destructive close() semantics.

POSIX

  • Feature: Added a pure C demo for the new C bridge.
  • Fix: Added regression coverage for oversized-key rejection and expiration overflow.

Win32

  • Fix: Fixed -Wmissing-braces warnings in Win32 file handling code.