Cordova SQLite 插件无法与 Android Studio 配合使用 [英] Cordova SQLite Plugin not functioning with Android Studio

查看:36
本文介绍了Cordova SQLite 插件无法与 Android Studio 配合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android Studio 中更新我的 Cordova 版本时遇到问题,因此我决定通过终端创建一个新的 Cordova 项目,然后将我的所有文件重新插入到 www 文件夹中(除了用于cordova.js 和cordova_plugins.js).当我运行我的模拟器时,除了我从资产文件夹中提取数据库的 SQLite 插件根本没有检索之外,一切都很好.我没有改变任何东西,甚至在查看代码和日志时,我看到频道没有被解雇".

I had trouble updating my cordova version in Android Studio and as a result I decided to just create a new Cordova project via terminal and then re-insert all my files back into the www folder (except for cordova.js and cordova_plugins.js). When I run my simulator, everything works great except the SQLite Plugin I have that pulls the database from the assets folder is not retrieving at all. I haven't changed anything and even looking at the code and logs I see "channel not fired".

这是问题的根本原因吗?我是 android studio 的新手,有一些我不知道的术语.我只是想让 SQLite 插件正确拉取,我认为不应该通过 Eclipse 从 Android Studio 更改任何代码.任何帮助都会非常感谢!

Is this the root cause of the issue? I'm new to android studio and there is terminology that I'm not aware of. I'm just trying to get SQLite Plugin to pull correctly and I don't think any code should have changed from Android Studio via Eclipse. Any help would be great thanks!

推荐答案

SQLite 也可以在没有任何插件的情况下工作.您可以按如下方式使用它.

SQLite also works without any plugin. You can use it as below.

var db = window.openDatabase(name, version, display_name, size);
db.transaction(populateDB, errorCB, successCB);

function populateDB(tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
    tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
    tx.executeSql('DROP TABLE IF EXISTS DEMO');
}

function errorCB(err) {
    alert("Error processing SQL: "+err.code);
}

function successCB() {
    alert("In Success");
}

有关详细信息,您可以参考链接.

For more details, you can refer this link.

这篇关于Cordova SQLite 插件无法与 Android Studio 配合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆