2011-12-01 43 views
4

當在模擬器中運行(使用的PhoneGap 1.1.0,Mac的10.6時,Eclipse 3.7.1)我得到這個錯誤:爲什麼在我的Android PhoneGap應用程序中出現此錯誤?

12-01 11:49:12.936: D/chromium(1062): Unknown chromium error: -6 
... 
12-01 11:49:13.476: I/System.out(1062): onReceivedError: Error code=-1 Description=A network error occurred. URL=file://android_asset/www/index.html 

,並在設備上我得到這個錯誤:

12-01 11:50:37.644: I/System.out(5319): onReceivedError: Error code=-14 Description= 
The requested file was not found. /android_asset/www/index.html (No such file or directory)  URL=file://android_asset/www/index.html 

我的應用程序只是一個光禿禿的骨頭演示類型的應用程序,到目前爲止,在它的唯一的代碼是這樣的javascript index.html文件中

function onBodyLoad() 
{   
    document.addEventListener("deviceready",onDeviceReady,false); 
} 

function onDeviceReady() 
{  
    document.addEventListener("resume", onResume, false); 
    onResume();  
} 

function onResume(){ 
    openBrowser('http://www.mysite.com/wap'); 
    //navigator.app.exitApp(); 
} 

function openBrowser(url){ 
     // document.location= url; 
} 

我一直在尋找有關類似的錯誤,其他職位,他們都SE EM建議設置 的java像這樣:

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    super.setStringProperty("loadingDialog", "Title,Message"); 
    this.setIntegerProperty("loadUrlTimeoutValue", 70000); 

    // setContentView(R.layout.main); 
    super.loadUrl("file://android_asset/www/index.html"); 
} 

或類似的東西,但它一直沒有幫助迄今爲止。 爲什麼我會收到這些錯誤,我能做些什麼呢? 感謝

回答

5

我需要三個斜槓之後是:super.loadUrl("file:

相反的:

super.loadUrl("file://android_asset/www/index.html"); 

用途:

super.loadUrl("file:///android_asset/www/index.html"); 
+0

爲什麼你需要三個而不是兩個,有什麼區別? –

+0

我有這樣的三個斜線,仍然沒有工作。 – juliangonzalez

相關問題