本文介绍了应用程序错误:出现网络错误(file:///assets/www/index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在eclipse juno上运行一个phonegap应用程序。android版本是4.1.2。该应用程序提供错误:
应用程序错误:网络错误(文件:///assets/www/index.html
当我尝试运行应用程序。
Android清单如下
<?xml version =1.0encoding =utf-8?>
< manifest xmlns:android =http://schemas.android.com/apk/res/androidandroid:windowSoftInputMode =adjustPan
package =com.initial.belgiumandroid:versionName =1.0android:versionCode =1android:hardwareAccelerated =true>
< supports-screens
android:largeScreens =true
android:normalScreens =true
android:smallScreens =true
android:xlargeScreens =true
android:resizeable =true
android:anyDensity =true
/>
< uses-permission android:name =android.permission.CAMERA/>
< uses-permission android:name =android.permission.VIBRATE/>
&l t; uses-permission android:name =android.permission.ACCESS_COARSE_LOCATION/>
< uses-permission android:name =android.permission.ACCESS_FINE_LOCATION/>
< uses-permission android:name =android.permission.ACCESS_LOCATION_EXTRA_COMMANDS/>
< uses-permission android:name =android.permission.INTERNET/>
< uses-permission android:name =android.permission.RECEIVE_SMS/>
< uses-permission android:name =android.permission.RECORD_AUDIO/>
< uses-permission android:name =android.permission.RECORD_VIDEO/>
< uses-permission android:name =android.permission.MODIFY_AUDIO_SETTINGS/>
< uses-permission android:name =android.permission.READ_CONTACTS/>
< uses-permission android:name =android.permission.WRITE_CONTACTS/>
< uses-permission android:name =android.permission.WRITE_EXTERNAL_STORAGE/>
< uses-permission android:name =android.permission.ACCESS_NETWORK_STATE/>
< uses-permission android:name =android.permission.GET_ACCOUNTS/>
< uses-permission android:name =android.permission.BROADCAST_STICKY/>
<应用程序android:icon =@ drawable / iconandroid:label =@ string / app_name
android:hardwareAccelerated =true
机器人:可调试= 真 >
< activity android:name =belgiumandroid:label =@ string / app_name
android:theme =@ android:style / Theme.Black.NoTitleBar
android: configChanges = 取向| keyboardHidden |键盘|屏幕尺寸|区域设置 >
< intent-filter>
< action android:name =android.intent.action.MAIN/>
< category android:name =android.intent.category.LAUNCHER/>
< / intent-filter>
< / activity>
< / application>
< uses-sdk android:minSdkVersion =7android:targetSdkVersion =16/>
< / manifest>
java源代码如下:
package com.initial.belgium;
import android.os.Bundle;
import org.apache.cordova。*;
public class belgium extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState) ;
super.loadUrl(file:///assets/www/index.html);
}
}
有人可以帮我修复吗?
谢谢
解决方案
尝试更改:
super.loadUrl( 文件:///assets/www/index.html);
To:
code> super.loadUrl( 文件:///android_asset/www/index.html);
I am trying to run a phonegap application on eclipse juno.The android version is 4.1.2. The application gives an error saying:
Application error: there was a network error(file:///assets/www/index.htmlwhen i try to run the app.
The android manifest is as follows
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
package="com.initial.belgium" android:versionName="1.0" android:versionCode="1" android:hardwareAccelerated="true">
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:hardwareAccelerated="true"
android:debuggable="true">
<activity android:name="belgium" android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>
</manifest>
The java source is as follows:
package com.initial.belgium;
import android.os.Bundle;
import org.apache.cordova.*;
public class belgium extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///assets/www/index.html");
}
}
Could someone help me fix this??Thanks
解决方案
Try changing:
super.loadUrl("file:///assets/www/index.html");
To:
super.loadUrl("file:///android_asset/www/index.html");
这篇关于应用程序错误:出现网络错误(file:///assets/www/index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!