I am currently experiencing an issue with my PhoneGap app on Android. Upon startup, the app inserts around 500 rows into an SQL database with a table containing 10 columns. Although this doesn't seem like a large amount of data, I have encountered crashes when working with the SQL database on certain versions of Android (1.6, 2.1, some 2.3.) The JSON file that I use to populate the DB is about 120 kB in size and resides within a text file. The code snippet I utilize for populating the database is causing the crash on Android 1.6:
db = window.openDatabase("db", "1.0", "Description", 1000000);
$.get('db/app_data.dat',function(result){
var data = $.parseJSON(result);
try {
db.transaction(function(tx){
$.each(data.items, function(i, v){
try {
tx.executeSql('INSERT INTO table(c1,c2,c3, ...) VALUES (?,?,?, ...)',[v.c1, v.c2, v.c3, ...]);
} catch(e) {
alert(e.message);
}
});
});
} catch(e) {
alert(e.message);
return;
}
});
I would appreciate any assistance or insights as to why this might be happening. Could there be some unanticipated limitations or bugs in Android that I'm unaware of?
EDIT:
Upon reviewing the LogCat output provided below, it seems that there are warnings related to JNI local reference tables overflowing. Unfortunately, my knowledge of Java and Android is limited, so any guidance on resolving this issue would be greatly appreciated.
...