Skip to content

Commit 32a65fe

Browse files
committed
feat(docs): enhance Android package integration instructions in README
1 parent d2bdaf5 commit 32a65fe

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ sqlite3_close(db)
8282
### Android Package
8383

8484
You can [add this project as a dependency to your Android project](https://central.sonatype.com/artifact/ai.sqlite/vector).
85+
86+
**build.gradle (Groovy):**
8587
```gradle
8688
repositories {
8789
google()
@@ -90,11 +92,32 @@ repositories {
9092
}
9193
9294
dependencies {
95+
// ...
9396
94-
...
95-
97+
// Use requery's SQLite instead of Android's built-in SQLite to support loading custom extensions
9698
implementation 'com.github.requery:sqlite-android:3.49.0'
97-
implementation 'ai.sqlite:vector:0.9.32' // or 'com.github.sqliteai:sqlite-vector:0.9.32'
99+
// Both packages below are identical - use either one
100+
implementation 'ai.sqlite:vector:0.9.32' // Maven Central
101+
// implementation 'com.github.sqliteai:sqlite-vector:0.9.32' // JitPack (alternative)
102+
}
103+
```
104+
105+
**build.gradle.kts (Kotlin):**
106+
```kotlin
107+
repositories {
108+
google()
109+
mavenCentral()
110+
maven(url = "https://jitpack.io")
111+
}
112+
113+
dependencies {
114+
// ...
115+
116+
// Use requery's SQLite instead of Android's built-in SQLite to support loading custom extensions
117+
implementation("com.github.requery:sqlite-android:3.49.0")
118+
// Both packages below are identical - use either one
119+
implementation("ai.sqlite:vector:0.9.32") // Maven Central
120+
// implementation("com.github.sqliteai:sqlite-vector:0.9.32") // JitPack (alternative)
98121
}
99122
```
100123

@@ -103,6 +126,7 @@ After adding the package, you'll need to [enable extractNativeLibs](https://gith
103126
Here's an example of how to use the package:
104127
```java
105128
import android.database.Cursor;
129+
import android.util.Log;
106130
import io.requery.android.database.sqlite.SQLiteCustomExtension;
107131
import io.requery.android.database.sqlite.SQLiteDatabase;
108132
import io.requery.android.database.sqlite.SQLiteDatabaseConfiguration;
@@ -122,17 +146,17 @@ import java.util.Collections;
122146
);
123147

124148
SQLiteDatabase db = SQLiteDatabase.openDatabase(config, null, null);
125-
149+
126150
Cursor cursor = db.rawQuery("SELECT vector_version()", null);
127151
if (cursor.moveToFirst()) {
128152
String version = cursor.getString(0);
129-
resultTextView.setText("vector_version(): " + version);
153+
Log.i("sqlite-vector", "vector_version(): " + version);
130154
}
131155
cursor.close();
132156
db.close();
133157

134158
} catch (Exception e) {
135-
resultTextView.setText("Error: " + e.getMessage());
159+
Log.e("sqlite-vector", "Error: " + e.getMessage());
136160
}
137161
}
138162
```

0 commit comments

Comments
 (0)