Skip to content

Tracking issue: Android Support #68

Open

Description

@asg017

sqlite-vec successfully compiles and run on Android (from what I tried on Termux on an old phone).

But how can we package and distribute sqlite-vec to make it easier for Android developers to use?

I don't know much about Android development or packages, so any help and insight would be greatly appreciated. I specifically have the following questions, so please answer in this thread if you know of an answer!

  • What Android SQLite client libraries are popular, and do they support dynamically loading SQLite extensions?
  • What "package managers" exist for 3rd party Android libraries?
  • How do Android libraries typically bundle pre-compiled shared object files?

P.S. - if you're company or organization would benefit from sqlite-vec on Android, I'd love to have you as a sponsor!

Activity

  1. Vali-98 commented on Aug 23, 2024

    @Vali-98

    On the react-native side, expo-sqlite is capable of loading .so files as sqlite3 plugins with a bit of patching, as demonstrated in this patch file I made for my react-native app: https://github.com/Vali-98/ChatterUI/blob/master/patches/expo-sqlite%2B14.0.5.patch

    Said function is unfortunately not exposed to the JS side of the library as of writing, but can be worked around.

    For whatever reason, .so files in react-native seem to cause issues if not following the convention of lib<name>.so stemming from some mechanism in the SoLoader library used to load source files. I found that if proguard rules stripped the SoLoader errors, it will lead to a crash.

    I would recommend the android source files be named libsqlitevec.so or something of that nature.

  2. waqasakram117 commented on Aug 25, 2024

    @waqasakram117
    • What Android SQLite client libraries are popular, and do they support dynamically loading SQLite extensions?
    • What "package managers" exist for 3rd party Android libraries?
    • How do Android libraries typically bundle pre-compiled shared object files?
    • Room is a popular library for sqlite3 and official ORM from Google. No, it doesn't support dynamic loading.
    • Maven Center can be used to distribute native/java/kotlin libraries
    • Shared objects should be compiled through NDK (Android Native Development Kit) then they can't be shared/embedded through cmake.
  3. ospfranco commented on Aug 26, 2024

    @ospfranco

    Hey, I'm the author of op-sqlite. I want to integrate sqlite-vec into my library. The best way you can help RN, Android (and IOS) devs is by adding a make file rule that compiles an .so for android and a .a for iOS with a rule in the makefile.

    For Android you need to be able to compile to 4 archs:

    "x86_64-apple-ios", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android", "i686-linux-android"
    

    At least on Rust those are the name of the archs, no idea on how to compile C to those specific archs. Once the files are generated it's a matter of packaging them to be consumed on iOS (via an xcframework) and Android (via an AAR or just a file structure).

    If you can provide some compilation instructions I can then integrate it into my library (and also expo-sqlite would follow the same steps)

  4. zivids commented on Dec 25, 2025

    @zivids
    • What Android SQLite client libraries are popular, and do they support dynamically loading SQLite extensions?

    Room is a official ORM from Google.
    sqlite-bundled support dynamically loading SQLite extensions, and it also provided by Google.

    sqlite-bundled provided BundledSQLiteDriver class, it's addExtension function support dynamically loading SQLite extensions

    val driver = BundledSQLiteDriver()
    driver.addExtension("vec0.so", "sqlite3_vec_init")
    Room.databaseBuilder(context, klass = MyDatabase::class.java, name = "my-db").setDriver(driver).build()
  5. ospfranco commented on Dec 25, 2025

    @ospfranco

    Binaries for Android are already released. You can download them from the releases page. You can them pack them however you want to be loaded into your Android app. There are many resources online on how to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions