android - 如何为 Android 设置本地存储路径
问题描述
我尝试嵌入由 QML 的 Local Storage for Android 生成的 sqlite 文件。下面的代码适用于桌面。尽管 Android 的 assets 文件夹中有 sqlite 和 ini 文件,但该应用程序不会将数据库文件视为默认文件。我怎样才能让它工作?
main.cpp 中的代码:
QString customPath = "assets:/OfflineStorage";
QDir dir;
if(dir.mkpath(QString(customPath))){
qDebug() << "Default path >> "+engine.offlineStoragePath();
engine.setOfflineStoragePath(QString(customPath));
qDebug() << "New path >> "+engine.offlineStoragePath();
}
engine.clearComponentCache();
解决方案
这里已经解决了。问题是将 sqlite 和 ini 文件复制到正确的位置。
推荐阅读
- java - 使用 Java 8 Streams 在 Java 中转换地图 - 根据地图的值分离地图
- java - oracle adf 11g EL 比较 partialTrigger 没有正确评估?
- anaconda - conda env 导出是否使用 pip?
- java - java - 为什么在java中使用FileReader时找不到我的文件
- mysql - 此 SELECT 语句的含义,它比较两个字符串值
- c# - HTML中的连续图片
- thymeleaf - 如何将 message.properties 值传递给 Thymeleaf 中的 String 实用程序方法
- javascript - 不可能的错误...并发问题?NextJs / 节点 HTTP 服务器
- r - 创建从数据框中调用值的重复文本行/变量
- pyspark - Databricks 笔记本中的多选小部件