Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在哪里安装SQLiteAndroidDatabase.java文件?_Android_Sqlite_Cordova - Fatal编程技术网

在哪里安装SQLiteAndroidDatabase.java文件?

在哪里安装SQLiteAndroidDatabase.java文件?,android,sqlite,cordova,Android,Sqlite,Cordova,我正在尝试在我的Phonegap应用程序中使用 我已经在我的应用程序页面中包含了SQLitePlugin.js,但是当我执行文档演示代码时,它会在控制台中返回此错误消息: [console.log] OPEN database: Database [console.log] new transaction is waiting for open operation [console.log] OPEN database: Database failed. aborting any pending

我正在尝试在我的
Phonegap
应用程序中使用

我已经在我的应用程序页面中包含了
SQLitePlugin.js
,但是当我执行文档演示代码时,它会在控制台中返回此错误消息:

[console.log] OPEN database: Database
[console.log] new transaction is waiting for open operation
[console.log] OPEN database: Database failed. aborting any pending transactions
[console.log] Could not open database
这是执行的代码:

// Wait for Cordova to load
document.addEventListener("deviceready", onDeviceReady, false);

// Cordova is ready
function onDeviceReady() {
  var db = window.sqlitePlugin.openDatabase("Database", "1.0", "Demo", -1);

  db.transaction(function(tx) {
    tx.executeSql('DROP TABLE IF EXISTS test_table');
    tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');

    tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], function(tx, res) {
      console.log("insertId: " + res.insertId + " -- probably 1");
      console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");

      tx.executeSql("select count(id) as cnt from test_table;", [], function(tx, res) {
        console.log("res.rows.length: " + res.rows.length + " -- should be 1");
        console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
      });

    }, function(e) {
      console.log("ERROR: " + e.message);
    });
  });
}
在文件中写下:

Install SQLiteAndroidDatabase.java and SQLitePlugin.java from src/android/io/liteglue into src/io/liteglue subdirectory

但我在我的项目中找不到
src
文件夹

您正在尝试在浏览器中运行它吗


在设备中它会工作,但在浏览器中它不会

你找到解决方案了吗?还没有,我保存在
localStorage
,但也许这可以帮助你
pookdb
是一个类似
mongoDb
的数据库,我在
pookdb
方面没有经验,但看起来我很实际这不是答案。这应该只是一个评论。一旦你赢得了声誉,你就可以发表评论了。当然,我只想发表评论,但我没有足够的理由这么做。这是完全可以理解的。一旦你有足够的钱,你将能够;相反