我正在尝试使用phonegap和localStorage创建一个应用程序,它在iOS上运行良好,但在Android上我收到以下错误:“返回的sqlite:错误代码= 14,msg =无法在[42537b6056]的第27205行打开文件”。
我正在寻找答案(谷歌搜索:))但没有成功。
代码和堆栈跟踪如下。
先感谢您。
// Wait for Cordova to load
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
customers = {
"data" : [
{
"name" : "Myself"
}
]
}
navigator.notification.alert(customers.data[0].name);
window.localStorage.setItem("customers", JSON.stringify(customers));
var retrievedCustomers = window.localStorage.getItem("customers");
c = JSON.parse(retrievedCustomers);
console.log(c);
navigator.notification.alert(c.data[0].name);
}
堆栈跟踪:
08-21 14:49:05.063: D/DroidGap(11816): DroidGap.onCreate()
08-21 14:49:05.223: D/CordovaWebView(11816): Origin to allow: http://127.0.0.1*
08-21 14:49:05.223: I/CordovaLog(11816): Found log level DEBUG
08-21 14:49:05.223: I/CordovaLog(11816): Changing log level to DEBUG(3)
08-21 14:49:05.223: I/CordovaLog(11816): Found preference for useBrowserHistory=false
08-21 14:49:05.223: D/CordovaLog(11816): Found preference for useBrowserHistory=false
08-21 14:49:05.233: D/DroidGap(11816): DroidGap.init()
08-21 14:49:05.253: D/CordovaWebView(11816): >>> loadUrl(file:///android_asset/www/index.html)
08-21 14:49:05.253: D/PluginManager(11816): init()
08-21 14:49:05.263: D/CordovaWebView(11816): >>> loadUrlNow()
08-21 14:49:05.273: D/SoftKeyboardDetect(11816): Ignore this event
08-21 14:49:05.303: D/SoftKeyboardDetect(11816): Ignore this event
08-21 14:49:05.353: D/SoftKeyboardDetect(11816): Ignore this event
08-21 14:49:05.413: D/DroidGap(11816): onMessage(onPageStarted,file:///android_asset/www/index.html)
08-21 14:49:05.463: D/szipinf(11816): Initializing inflate state
08-21 14:49:05.463: D/szipinf(11816): Initializing zlib to inflate
08-21 14:49:05.513: D/szipinf(11816): Initializing inflate state
08-21 14:49:05.513: D/szipinf(11816): Initializing inflate state
08-21 14:49:05.513: D/szipinf(11816): Initializing zlib to inflate
08-21 14:49:05.583: D/szipinf(11816): Initializing zlib to inflate
08-21 14:49:05.593: D/szipinf(11816): Initializing inflate state
08-21 14:49:05.603: D/szipinf(11816): Initializing zlib to inflate
08-21 14:49:05.813: D/dalvikvm(11816): GC_CONCURRENT freed 134K, 44% free 3390K/6023K, external 0K/0K, paused 4ms+9ms
08-21 14:49:09.143: D/Cordova(11816): onPageFinished(file:///android_asset/www/index.html)
08-21 14:49:09.143: D/CordovaWebView(11816): >>> loadUrlNow()
08-21 14:49:09.143: D/DroidGap(11816): onMessage(onNativeReady,null)
08-21 14:49:09.143: D/DroidGap(11816): onMessage(onPageFinished,file:///android_asset/www/index.html)
08-21 14:49:09.183: I/Database(11816): sqlite returned: error code = 14, msg = cannot open file at line 27205 of [42537b6056]
08-21 14:49:09.253: E/Cordova(11816): Error loading url gap://ready
08-21 14:49:09.253: E/Cordova(11816): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=gap://ready }
08-21 14:49:09.253: E/Cordova(11816): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
08-21 14:49:09.253: E/Cordova(11816): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
08-21 14:49:09.253: E/Cordova(11816): at android.app.Activity.startActivityForResult(Activity.java:2827)
08-21 14:49:09.253: E/Cordova(11816): at android.app.Activity.startActivity(Activity.java:2933)
08-21 14:49:09.253: E/Cordova(11816): at org.apache.cordova.CordovaWebViewClient.shouldOverrideUrlLoading(CordovaWebViewClient.java:187)
08-21 14:49:09.253: E/Cordova(11816): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:216)
08-21 14:49:09.253: E/Cordova(11816): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:323)
08-21 14:49:09.253: E/Cordova(11816): at android.os.Handler.dispatchMessage(Handler.java:99)
08-21 14:49:09.253: E/Cordova(11816): at android.os.Looper.loop(Looper.java:130)
08-21 14:49:09.253: E/Cordova(11816): at android.app.ActivityThread.main(ActivityThread.java:3835)
08-21 14:49:09.253: E/Cordova(11816): at java.lang.reflect.Method.invokeNative(Native Method)
08-21 14:49:09.253: E/Cordova(11816): at java.lang.reflect.Method.invoke(Method.java:507)
08-21 14:49:09.253: E/Cordova(11816): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
08-21 14:49:09.253: E/Cordova(11816): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
08-21 14:49:09.253: E/Cordova(11816): at dalvik.system.NativeStart.main(Native Method)
08-21 14:49:11.153: D/DroidGap(11816): onMessage(spinner,stop)
08-21 14:49:14.316: D/CordovaWebView(11816): KeyDown has been triggered on the view
08-21 14:49:14.323: D/CordovaWebView(11816): >>> loadUrlNow()
08-21 14:49:14.783: D/DroidGap(11816): onDestroy()
08-21 14:49:14.783: D/CordovaWebView(11816): >>> loadUrlNow()
08-21 14:49:14.783: D/CordovaWebView(11816): >>> loadUrlNow()
08-21 14:49:14.803: D/DroidGap(11816): onMessage(onPageStarted,about:blank)
08-21 14:49:14.863: D/Cordova(11816): onPageFinished(about:blank)
08-21 14:49:14.863: D/DroidGap(11816): onMessage(onPageFinished,about:blank)
08-21 14:49:14.863: D/DroidGap(11816): onMessage(exit,null)
08-21 14:49:19.843: D/dalvikvm(11816): GC_EXPLICIT freed 350K, 49% free 3118K/6023K, external 0K/0K, paused 61ms