【发布时间】:2014-07-12 05:48:40
【问题描述】:
我正在尝试学习 Phonegap 并使用互联网上的教程制作了第一个应用程序,但我的应用程序崩溃并显示应用程序错误,因为存在网络错误(file://android_asset/www/index.html)。我已经尝试了很多东西,但还没有对我有用。请任何人帮助。提前致谢。 这是我的日志猫输出:
07-12 05:33:39.109: D/DroidGap(1395): Resuming the App
07-12 05:33:39.113: D/chromium(1395): Unknown chromium error: -6
07-12 05:33:39.653: D/DroidGap(1395): onMessage(onPageStarted,file://android_asset/www/index.html)
07-12 05:33:39.733: D/Cordova(1395): CordovaWebViewClient.onReceivedError: Error code=-1 Description=There was a network error. URL=file://android_asset/www/index.html
07-12 05:33:39.773: D/DroidGap(1395): onMessage(onReceivedError,{"errorCode":-1,"url":"file:\/\/android_asset\/www\/index.html","description":"There was a network error."})
07-12 05:33:40.121: D/DroidGap(1395): onMessage(onPageStarted,file://android_asset/www/index.html)
07-12 05:33:40.273: D/Cordova(1395): onPageFinished(file://android_asset/www/index.html)
07-12 05:33:40.277: D/DroidGap(1395): onMessage(onNativeReady,null)
07-12 05:33:40.305: D/DroidGap(1395): onMessage(onPageFinished,file://android_asset/www/index.html)
07-12 05:33:40.309: I/Choreographer(1395): Skipped 51 frames! The application may be doing too much work on its main thread.
07-12 05:33:40.365: D/SoftKeyboardDetect(1395): Ignore this event
07-12 05:33:41.105: W/EGL_emulation(1395): eglSurfaceAttrib not implemented
07-12 05:33:41.417: W/EGL_emulation(1395): eglSurfaceAttrib not implemented
07-12 05:33:41.421: I/Choreographer(1395): Skipped 62 frames! The application may be doing too much work on its main thread.
07-12 05:33:41.541: D/OpenGLRenderer(1395): TextureCache::get: create texture(0xb81cadf0): name, size, mSize = 21, 1048576, 1072788
07-12 05:33:41.985: D/Cordova(1395): onPageFinished(file://android_asset/www/index.html)
07-12 05:33:42.125: D/DroidGap(1395): onMessage(onNativeReady,null)
07-12 05:33:42.165: D/DroidGap(1395): onMessage(onPageFinished,file://android_asset/www/index.html)
07-12 05:33:42.265: D/SoftKeyboardDetect(1395): Ignore this event
07-12 05:44:42.961: D/dalvikvm(1395): GC_CONCURRENT freed 164K, 5% free 6470K/6791K, paused 23ms+3ms, total 41ms
07-12 05:44:42.993: D/webviewglue(1395): nativeDestroy view: 0xb82b8310
这是 index.html
<!DOCTYPE HTML>
<HTML>
<head>
<title>AjpdSoft PhoneGap</title>
<script type="text/JavaScript" CharSet="UTF-8" SRC="CORDOVA-2.2.0.JS"></script>
</head>
<body>
<h1>Hello world PhoneGap</h1>
<p>Example of application Android with PhoneGap and Eclipse</p>
< /body>
</HTML>
这是我的 MainActivity.java
import android.os.Bundle;
//import org.Apache.cordova.*;
import org.apache.cordova.DroidGap;
public class MainActivity extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file://android_asset/www/index.html");
}
}
我正在尝试在 genymotion 上运行该应用。
【问题讨论】:
-
你好,请给我看看你的 helloword.java 文件
-
请检查我已经编辑了问题并添加了 MainActivity.java