简体   繁体   English

缺少带有Visual Studio 2015的Apache Cordova中的exec:SQLitePlugin.open

[英]missing exec:SQLitePlugin.open in Apache Cordova with Visual Studio 2015

I am new in mobile app for the database using sqlite after searching on goolge I configure my project in visual studio but I am getting two error 在goolge上搜索后,我在使用sqlite的数据库的移动应用程序中是新手,我在Visual Studio中配置了项目,但出现两个错误 在此处输入图片说明

after click on success get 2nd error 单击成功后出现第二个错误

在此处输入图片说明

I am not getting any solution after searching. 搜索后没有任何解决方案。

I include SQLitePlugin.js in my html page and code for sqlite is 我在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.
};

})(); })();

What the mistake here? 这是什么错误?

When you call window.sqlitePlugin.openDatabase , SQLite Plugin will execute java native codes, which is not supported by Ripple. 当您调用window.sqlitePlugin.openDatabase ,SQLite插件将执行Java本机代码,Ripple不支持。 From this document : 从此文件

Caution: Ripple doesn't provide a complete simulation of Cordova APIs or native device capabilities (plugins). 注意:Ripple没有提供Cordova API或本机设备功能(插件)的完整模拟。 It also doesn't simulate specific browser versions for a particular platform. 它还不会针对特定平台模拟特定的浏览器版本。 You can achieve this by testing on actual devices or emulators. 您可以通过在实际设备或仿真器上进行测试来实现。

Please try that by Android Emulator or real devices. 请通过Android模拟器或真实设备尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM