2013-06-03 69 views
0

在i從由煎茶觸摸開發的HTML文件如下產生錯誤加載:CordovaWebViewClient.onReceivedError在PhoneGap的+煎茶+ Android應用程序

E/CordovaWebView(1897): CordovaWebView: TIMEOUT ERROR! CordovaWebViewClient.onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=file:///android_asset/www/index.html

的index.html被

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="UTF-8" /> 
<title>Creating a simple XTemplate list in Sencha Touch 2</title> 
<link 
    href="http://cdn.sencha.io/touch/sencha-touch-2.1.0/resources/css/sencha-touch.css" 
    rel="stylesheet" /> 
<script 
    src="http://cdn.sencha.io/touch/sencha-touch-2.1.0/sencha-touch-all-debug.js" 
    type="text/javascript"></script> 
<link href="app/styles.css" rel="stylesheet" type="text/css" /> 
<script src="app.js" type="text/javascript"></script> 
</head> 
<body> 
</body> 
</html> 

app.js

/*global Ext:false */ 
Ext.application({ 
    launch: function() { 
     Ext.create('Ext.Container', { 
      fullscreen: true, 
      styleHtmlContent: true, 
      data: [{ 
       fname: 'Stratton', 
       lname: 'Sclavos', 
       role: 'Executive Chairman' 
      }, { 
       fname: 'Michael', 
       lname: 'Mullany', 
       role: 'CEO' 
      }, { 
       fname: 'Ted', 
       lname: 'Driscoll', 
       role: 'Vice President Worldwide Sales' 
      }, { 
       fname: 'Abraham', 
       lname: 'Elias', 
       role: 'Chief Technical Officer' 
      }, { 
       fname: 'Jeff', 
       lname: 'Hartley', 
       role: 'Vice President of Services and Training' 
      }, { 
       fname: 'Adam', 
       lname: 'Mishcon', 
       role: 'Vice President of Operations' 
      }, { 
       fname: 'Judy', 
       lname: 'Lin', 
       role: 'Vice President of Engineering' 
      }], // data 
      tpl: '<tpl for="."><div><strong>{lname}</strong>, {fname} <em class="muted">({role})</em></div></tpl>' 
     }); // create() 
    } // launch 
}); // application() 

MainActivity,JAVA

package com.example.senchahelloandroid; 

import org.apache.cordova.DroidGap; 

import android.os.Bundle; 

public class MainActivity extends DroidGap { 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 

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

    } 

} 

回答

0

好吧,你可以做一些事情來解決這個問題:

  • 檢查您已設置爲INTERNET_CONNECTION許可在 AndroidManifest文件。
  • 您可以嘗試從互聯網上下載鏈接文件(Sencha-touch.csssencha-touch-all-debug.js)並將它們設置爲本地。
  • 您可以添加此行super.setIntegerProperty(「loadUrlTimeoutValue」,7000); under super.onCreate(savedInstanceState);在你的MainActivity.java文件中
+0

我已經做了上面的修改,然後apk不能安裝。無法在設備'emulator-5556'上安裝SenchaHelloAndroid.apk:超時。啓動取消! –

+0

您是否嘗試增加計時器值?喜歡而不是7000,你可以把10000或更多類似的東西 – GenieWanted

+0

是的,但沒有影響 –