sqflite-android-setup

Configures and troubleshoots the sqflite Android implementation for Flutter SQLite databases.

3.0k|555|Updated May 22, 2017
One-click install
npx skills add https://github.com/tekartik/sqflite --skill sqflite-android-setup-tekartik
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sqflite-android-setup
Source: https://github.com/tekartik/sqflite/tree/main/sqflite_android/skills/sqflite-android-setup
Command: npx skills add https://github.com/tekartik/sqflite --skill sqflite-android-setup-tekartik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Flutter developers using sqflite on Android hit platform-specific issues: WAL pragma failures, CursorWindow row-size limits, corrupt database handling, MissingPluginException in release builds, and Gradle/AGP build errors. This Skill provides the exact configuration and troubleshooting knowledge for the sqflite_android plugin. ## Core Features & Use Cases - Plugin Setup Guidance: Explains when to add sqflite_android explicitly versus relying on the sqflite umbrella package, plus minSdk 19, Java 17, and AGP requirements. - Android-Specific Behaviors: Covers WAL enablement via manifest meta-data or setJournalMode, read-only opening with corruption handling, androidSetLocale for COLLATE LOCALIZED sorting, and the background worker thread model. - Troubleshooting Playbook: Diagnoses the 1 MB CursorWindow limit, OutOfMemoryError on bulk writes, extended SQLite error codes, and release-mode MissingPluginException caused by shrinkResources/minifyEnabled. - Use Case: Your Android release build throws MissingPluginException while debug works fine. The Skill tells you to remove shrinkResources and minifyEnabled from the app build.gradle. ## Quick Start Ask how to enable WAL mode for sqflite on Android or why a release build fails with MissingPluginException.

Frequently Asked Questions about sqflite-android-setup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable WAL mode in sqflite on Android?▼

Enable WAL either globally with the com.tekartik.sqflite.wal_enabled meta-data set to true inside the application tag of AndroidManifest.xml, or per open by calling db.setJournalMode('WAL') in onConfigure. Calling execute('PRAGMA journal_mode=WAL') directly fails on Android without the manifest flag.

When should I add sqflite_android to pubspec.yaml explicitly?▼

Add sqflite_android explicitly only when your app does not depend on the sqflite package, for example when coding against package:sqflite_common for an Android-only app. If you already depend on sqflite, sqflite_android is pulled in automatically and adding it is redundant.

Why does sqflite throw MissingPluginException only in Android release mode?▼

MissingPluginException in release builds is caused by shrinkResources true and minifyEnabled true in the app's build.gradle. Remove those two lines and the plugin registers correctly in release mode.

What causes SQLiteBlobTooBigException or Row too big to fit into CursorWindow?▼

A single row must fit in Android's CursorWindow, about 1 MB. Storing large blobs such as images in a row exceeds this limit; store the data in files instead. For OutOfMemoryError on writes, split work into smaller transactions of around 1000 operations.

Does sqflite on Android support JSON1, UPSERT, or RETURNING?▼

sqflite_android uses the SQLite shipped with the Android OS, so feature support depends on the device's SQLite version. Check SELECT sqlite_version() at runtime, or use sqflite_common_ffi to bundle a newer SQLite instead.

How do I sort query results with localized collation on Android?▼

Call db.androidSetLocale with a locale such as 'zh-CN' in onConfigure at every open, using the extension from package:sqflite/sqflite.dart. Then query with orderBy set to 'name COLLATE LOCALIZED ASC' for locale-aware sorting.