我已经使用 ST2 制作了一个试用应用程序,它在仅使用 ST2 时工作得很好,但是当我尝试使用 PhoneGap 在 android 模拟器上运行这个应用程序时,它似乎无法加载我的 html5/JS ST2 文件并抛出 java.io .FileNotFoundException: www/event/Dispatcher.js ...
结果 -> 白屏
堆栈跟踪:
07-10 12:15:52.701: I/CordovaLog(536): Changing log level to DEBUG(3)
07-10 12:15:52.701: I/CordovaLog(536): Found preference for useBrowserHistory=false
07-10 12:15:52.711: D/CordovaLog(536): Found preference for useBrowserHistory=false
07-10 12:15:52.721: D/DroidGap(536): DroidGap.init()
07-10 12:15:52.771: I/dalvikvm(536): threadid=3: reacting to signal 3
07-10 12:15:52.841: D/CordovaWebView(536): >>>loadUrl(file:///android_asset/www/index.html)
07-10 12:15:52.841: D/PluginManager(536): init()
07-10 12:15:52.871: I/dalvikvm(536): Wrote stack traces to '/data/anr/traces.txt'
07-10 12:15:52.891: D/CordovaWebView(536): >>> loadUrlNow()
07-10 12:15:52.921: D/SoftKeyboardDetect(536): Ignore this event
07-10 12:15:53.011: W/webcore(536): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1683)
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:926)
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1795)
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebView.sendOurVisibleRect(WebView.java:2917)
07-10 12:15:53.011: W/webcore(536): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
07-10 12:15:53.011: W/webcore(536): at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
07-10 12:15:53.011: W/webcore(536): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
07-10 12:15:53.011: W/webcore(536): at android.os.Handler.handleCallback(Handler.java:605)
07-10 12:15:53.011: W/webcore(536): at android.os.Handler.dispatchMessage(Handler.java:92)
07-10 12:15:53.011: W/webcore(536): at android.os.Looper.loop(Looper.java:137)
07-10 12:15:53.011: W/webcore(536): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-10 12:15:53.011: W/webcore(536): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 12:15:53.011: W/webcore(536): at java.lang.reflect.Method.invoke(Method.java:511)
07-10 12:15:53.011: W/webcore(536): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-10 12:15:53.011: W/webcore(536): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-10 12:15:53.011: W/webcore(536): at dalvik.system.NativeStart.main(Native Method)
07-10 12:15:53.011: D/SoftKeyboardDetect(536): Ignore this event
07-10 12:15:53.041: D/gralloc_goldfish(536): Emulator without GPU emulation detected.
07-10 12:15:53.441: D/DroidGap(536): onMessage(onPageStarted,file:///android_asset/www/index.html)
07-10 12:15:53.631: D/dalvikvm(536): GC_CONCURRENT freed 181K, 4% free 9316K/9607K, paused 6ms+4ms
07-10 12:15:56.681: E/generateWebResourceResponse(536): www/event/Dispatcher.js
07-10 12:15:56.681: E/generateWebResourceResponse(536): java.io.FileNotFoundException: www/event/Dispatcher.js
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.content.res.AssetManager.openAsset(Native Method)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.content.res.AssetManager.open(AssetManager.java:315)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse(CordovaWebViewClient.java:492)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.shouldInterceptRequest(CordovaWebViewClient.java:465)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.CallbackProxy.shouldInterceptRequest(CallbackProxy.java:1078)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.BrowserFrame.shouldInterceptRequest(BrowserFrame.java:951)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.nativeServiceFuncPtrQueue(Native Method)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:113)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.os.Looper.loop(Looper.java:137)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:728)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at java.lang.Thread.run(Thread.java:856)
07-10 12:15:56.721: E/generateWebResourceResponse(536): www/event/publisher/Dom.js
07-10 12:15:56.721: E/generateWebResourceResponse(536): java.io.FileNotFoundException: www/event/publisher/Dom.js
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.content.res.AssetManager.openAsset(Native Method)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.content.res.AssetManager.open(AssetManager.java:315)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse(CordovaWebViewClient.java:492)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.shouldInterceptRequest(CordovaWebViewClient.java:465)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.CallbackProxy.shouldInterceptRequest(CallbackProxy.java:1078)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.BrowserFrame.shouldInterceptRequest(BrowserFrame.java:951)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.nativeServiceFuncPtrQueue(Native Method)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:113)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.os.Looper.loop(Looper.java:137)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:728)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at java.lang.Thread.run(Thread.java:856)
07-10 12:15:56.731: D/chromium(536): Unknown chromium error: -6
07-10 12:15:56.731: D/chromium(536): Unknown chromium error: -6
07-10 12:15:56.731: D/Cordova(536): onPageFinished(file:///android_asset/www/index.html)
07-10 12:15:56.731: D/CordovaWebView(536): >>> loadUrlNow()
07-10 12:15:56.731: D/DroidGap(536): onMessage(onNativeReady,null)
07-10 12:15:56.731: D/DroidGap(536): onMessage(onPageFinished,file:///android_asset/www/index.html)
07-10 12:15:56.911: I/SqliteDatabaseCpp(536): sqlite returned: error code = 14, msg = cannot open file at line 27701 of [8609a15dfa], db=/data/data/clearitm.mobility.hellosenchacordova/databases/webview.db
07-10 12:15:56.911: I/SqliteDatabaseCpp(536): sqlite returned: error code = 14, msg = os_unix.c: open() at line 27701 - "" errno=2 path=/CachedGeoposition.db, db=/data/data/clearitm.mobility.hellosenchacordova/databases/webview.db
07-10 12:15:57.042: D/DroidGap(536): onMessage(networkconnection,3g)
07-10 12:15:58.789: D/DroidGap(536): onMessage(spinner,stop)
index.html 代码:
<!DOCTYPE html>
<html>
<header>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sencha Touch 2 Teste</title>
<link rel="stylesheet" href="sencha-touch.css" type="text/css">
<script type="text/javascript" src="sencha-touch.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
<script type="text/javascript" charset="utf-8" src="app/app.js"></script>
</header>
<body>
</body>
</html>
应用程序.js:
Ext.Loader.setConfig({
enable: true
});
Ext.application({
name:'Touch2Demo',
views: [
'ContatosList',
'ContatosForm'
],
models: [
'Contato'
],
controllers: [
'Main'
],
stores: [
'Contatos'
],
viewport:{
layout:{
type: 'card',
animation: {
type: 'slide',
duration: 1000
}
}
},
launch: function(){
}
});
主要的java类:
import org.apache.cordova.DroidGap;
import android.os.Bundle;
public class HelloSenchaCordovaActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
资产文件夹结构:
assets>
www>
app>
app.js
controller
data
model
profile
store
view
sencha>
resources>
sencha-touch.js
cordova-1.9.0.js
sencha-touch.js
sencha-touch.css
index.html
我已经搜索了有关此类问题的其他问题,但这些解决方案都没有解决我的问题:/关于这里有什么问题的任何线索?
谢谢 !