Menu

How to use SQLite with Zeos on Android Log in to Edit

marsupilami79

The following strategy worked:

  • download the sqlite-android-3360000.aar from sqlite.org
  • Rename the aar file to be a zip file
  • extract it
  • find the libsqliteX.so in the jni\armeabi-v7a subdirectory
  • a 64 bits version can be found in jni\arm64-v8a

The following source code worked for getting a database file created:

    ZConnection1.LibraryLocation := TPath.Combine(TPath.GetHomePath, 'libsqliteX.so');
    DbLocation := TPath.Combine(TPath.GetDocumentsPath, 'db_sqlite.db');
    Memo1.Lines.Append(DbLocation);
    ZConnection1.Database := DbLocation;
    ZConnection1.Protocol := 'sqlite';
    ZConnection1.ClientCodepage := 'UTF-8';
    ZConnection1.Connected := true;
    Memo1.Lines.Append(BoolToStr(FileExists(DbLocation), True));

In the deployment settings tell Delphi to deploy the libsqliteX.so file to ".\assets\internal\".