phoneGap Buil返回了不受支持的插件:sqliteplugin

我也是Phonegap和堆栈溢出的新手。我正在构建需要存储的应用程序,在阅读了很多论坛后,我决定尝试使用SQLite插件,到目前为止,一切正常,直到构建过程为止,它都返回“不支持的插件:sqliteplugin”红色警报消息。 我尝试过这个旧建议: plugin unsupported: sqliteplugin 建议执行以下操作: cordova插件添加https://github.com/brodysoft/Cordova-SQLitePlugin.git

但是在通过Node.js控制台运行它之后,它返回: npm ERR! enoent未定义ls-remote -h -t https://github.com/brodysoft/Cordova-SQLitePlugin.git

我仍然通过执行以下命令通过CLI添加了插件:cordova plugin add cordova-sqlite-storage

这是 onDeviceReady 函数的一个示例:

var _globalDB;

function onDeviceReady() {

    var devicePlatform = device.platform;
    if (devicePlatform == "Android" || devicePlatform == "browser"){
        // Works on android but not in iOS
        _globalDB = window.openDatabase("testDB.db","1.0","testDB DB",1000000);
    } else{
        // Works on iOS 
        _globalDB = window.sqlitePlugin.openDatabase({ name: "testDB.db",location: 2,createFromLocation: 1}); 
    } 
    _globalDB.transaction(function(tx) {
        tx.executeSql('CREATE TABLE IF NOT EXISTS TableName (id integer primary key,type text,value text)');
    });
    ShowRecords();
}

config.xml 部分:

<?xml version='1.0' encoding='utf-8'?>
<widget id="APPID" version="1.0.0" versionCode="10" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">

    <content src="index.html" />

    <gap:plugin name="SQLitePlugin" value="io.liteglue.SQLitePlugin" />
    <gap:plugin name="SQLitePlugin" value="SQLitePlugin" />
    <gap:plugin name="SQLitePlugin" value="org.sqliteexample.sample.sqlitePlugin.SQLitePlugin" />

</widget>

Index.html 药水:

<!DOCTYPE html>
<html>
<head>

</head>
<body onunload="goingAway();">
    <div data-role="page" data-control-title="test" id="testPage" data-theme="A" class="ui-content-transparent">

    </div>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/SQLitePlugin.js"></script>
    <script src="js/index.js" type="text/javascript"></script>
</body>
</html>

根项目的文件夹包含:

/platforms/
/plugins/
/www/

如今,SQLite插件在将数据存储在移动应用程序上还是有意义且有效吗?

真的很感谢任何帮助/指导。

yunmengyi 回答:phoneGap Buil返回了不受支持的插件:sqliteplugin

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3132506.html

大家都在问