android - 无法使用 Delphi 10.4 在 Android 中加载 sqlite 库
问题描述
使用 Delphi 10.4,我的 Android 应用程序出现错误(32 位和 64 位的错误相同)。
[FireDAC][物理][SQLite]-314。无法加载供应商库 [libsqlite.so 或 libdb_sql.so]。提示:检查它是否在 PATH 或应用程序 EXE 目录中,并且具有 x86 位。
它在以前版本的 Delphi(最新 10.3.3)中运行良好。
是 bug 还是 Delphi 10.4 发生了一些变化?
constructor TBrDataAccess.Create;
var
AppDataName: string;
DBExists: boolean;
begin
try
FFDGUIxProvider := 'Console';
AppDataName := TPath.GetDocumentsPath + PathDelim + GetFileName;
DBExists := FileExists(AppDataName);
FConnection:=TFDConnection.Create(nil);
FConnection.Params.Add('DriverID=SQLite');
FConnection.Params.Add('Database=' + AppDataName);
FConnection.Params.Add('OpenMode=CreateUTF8');
FConnection.Params.Add('DateTimeFormat=String');
FConnection.Params.Add('LockingMode=Normal');
FConnection.Params.Add('Synchronous=Normal');
FConnection.Params.Add('BusyTimeout=7500');
FConnection.Params.Add('SharedCache=False');
FConnection.FetchOptions.Mode := fmAll; // Meget vigtig ved SqLite.
FConnection.UpdateOptions.LockWait := True;
FConnection.Connected := true;
if not DBExists
then if FConnection.ExecSQLScalar('pragma schema_version;') = 0
then CreateDb;
except
on E : Exception
do TBrMobileLog.AddLog(TBrLogFileType.LFTDb, 'TBrDataAccess', 'Create', E.Message, True);
end;
end;
解决方案
尝试将FireDAC.Phys.SQLiteWrapper.Stat单元包含到使用子句中。非常感谢大软。现在 Sqlite 在 Android x64 下工作。
推荐阅读
- vim - Vim Ctrlp 插件在 Windows 中搜索另一个驱动器中的文件
- php - 无法连接到 SMTP 主机 - 无法验证证书
- html - 是否将文本直接放入有可访问性影响吗?
- mobile - 文档呈现解决方案的同步滚动
- python - 为什么 KMP 比 naive 慢?
- spring-boot - @ManyToOne 默认是否被索引
- angular - Angular 12 未绑定到来自 webapi 的值:返回 NgFor 仅支持绑定到 Iterables,例如数组
- floating-point - 在 VHDL 和后验综合中使用常量
- odata - 将租户 ID 附加到 odata 客户端 SaveChanges 的 url
- apache-spark - Azure Databricks 增量删除上的广播超时