Description
Hawk is a small Android library for storing key-value data without writing a database schema. You save a value under a key and read it back later, and it can hold primitives, strings, custom objects, lists, sets and maps. Values are persisted in app-private SharedPreferences. Gson is the default parser, and you can supply your own parser with custom type adapters or replace any stage of the pipeline, including the encryption and storage layers. Hawk can check whether a key exists, count entries, and delete single keys or everything at once. A null value deletes the key, and a missing key returns null or the default you give. The published 2.0.1 release is the current version, and it uses legacy Conceal encryption that may fall back to Base64 only storage. Hawk 3.0 is not released yet; it is planned to use AES-256-GCM with an Android Keystore key and to require Android 6.0 or newer. Reads and writes are synchronous, so heavy work should be moved off the main thread. Hawk is open source on GitHub.…
Highlights
- Store primitives, objects, lists, sets and maps by key
- Persists to app-private SharedPreferences
- Pluggable parser, encryption and storage
- Check, count and delete entries
- Synchronous reads and writes
Ratings & Reviews
No ratings yet
Be the first to rate Hawk.
People also visit
Hawk FAQ
What is Hawk?
Hawk is an Android library for simple key-value storage. It saves values under keys in SharedPreferences, so you do not need to design a database for simple data.
How do I install it?
Add the library from Maven Central, then initialize Hawk once with an application context before reading or writing.
Is the data encrypted?
The published 2.0.1 release uses legacy Conceal encryption and may fall back to Base64 only storage. Hawk 3.0, which is not released yet, is planned to use AES-256-GCM with a Keystore key. NoEncryption is available for data that does not need protection, and it only Base64-encodes values.
Can I upgrade from Hawk 2 to Hawk 3?
Not directly. Hawk 3.0 cannot read Hawk 2 default ciphertext. Read and migrate your values with the old library first, then save them again with the new encryption. Unmigrated values are not cleared automatically, and get returns null or your default when decryption fails.
Does deleteAll remove my encryption key?
No. deleteAll clears the stored values but keeps the encryption keys, so other values are not invalidated.
What Android versions does it support?
The published 2.0.1 artifact declares API 10 as its minimum. The unreleased 3.0 version requires Android 6.0 (API 23) or newer.
Is it free?
Yes. Hawk is open source and its code is on GitHub.
What are the best Hawk alternatives?
Popular alternatives to Hawk include Keyper Docs, CypherKeep and React Native Mmkv Storage. See all Hawk alternatives



