gpt4 book ai didi

javascript - 使用 Visual Studio 2015 在 Apache Cordova 中打开缺少 exec :SQLitePlugin.

转载 作者:行者123 更新时间:2023-11-30 16:02:16 26 4
gpt4 key购买 nike

在 goolge 上搜索后,我是使用 sqlite 的数据库移动应用程序的新手 我在 visual studio 中配置我的项目,但我收到两个错误 enter image description here

点击成功后出现第二个错误

enter image description here

我搜索后没有得到任何解决方案。

我在我的 html 页面中包含了 SQLitePlugin.js,sqlite 的代码是

(function () {
"use strict";

document.addEventListener('deviceready', onDeviceReady.bind(this), false);

function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({ name: 'my.db', location: 'default' }, function (db) {

// Here, you might create or open the table.
db.executeSql('CREATE TABLE customerAccounts (firstname, lastname, acctNo)');

}, function (error) {
console.log('Open database ERROR: ' + JSON.stringify(error));
});


// Handle the Cordova pause and resume events
document.addEventListener('pause', onPause.bind(this), false);
document.addEventListener('resume', onResume.bind(this), false);

// TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
var element = document.getElementById("deviceready");
element.innerHTML = 'Device Ready';
element.className += ' ready';
};

function onPause() {
// TODO: This application has been suspended. Save application state here.
};

function onResume() {
// TODO: This application has been reactivated. Restore application state here.
};

})();

这里有什么错误?

最佳答案

调用window.sqlitePlugin.openDatabase时,SQLite Plugin会执行java native代码,Ripple不支持。从这个document :

Caution: Ripple doesn’t provide a complete simulation of Cordova APIs or native device capabilities (plugins). It also doesn’t simulate specific browser versions for a particular platform. You can achieve this by testing on actual devices or emulators.

请通过 Android Emulator 或真实设备尝试。

关于javascript - 使用 Visual Studio 2015 在 Apache Cordova 中打开缺少 exec :SQLitePlugin.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37545691/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com