PhoneGap的1.8.1 - super.loadUrl("文件:///android_asset/www/index.html")问题 [英] PhoneGap 1.8.1 - super.loadUrl("file:///android_asset/www/index.html") issue
问题描述
我刚刚下载并使用最新版本的PhoneGap的:v.1.8.1
I'd just download and use latest version of phonegap : v.1.8.1
像往常一样,我替换 super.loadUrl的
的setContentView(R.layout.main)
行(文件:/// android_asset / WWW / index.html的);
as usual, I replace the setContentView(R.layout.main)
line with super.loadUrl("file:///android_asset/www/index.html");
在测试我的hello world应用程序,它总是会强制关闭。该应用程序无法正常运行。但是,如果我变回行成的setContentView(R.layout.main)
,应用程序将运行正常,没有任何问题(应用程序)。真正的问题是,应用程序不会加载的index.html,因为没有 super.loadUrl(文件:///android_asset/www/index.html);
行了。
When I test my "hello world" application, it will always force close. The app can't run properly. But if i change back the line into setContentView(R.layout.main)
, the app will run properly and there is no problem (for the application). The real problem is, the application not load the index.html because there is no super.loadUrl("file:///android_asset/www/index.html");
line.
这是我的code:
package com.urfinder.android;
import android.os.Bundle;
import org.apache.cordova.DroidGap;
public class URFinderActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}`
任何人都可以给我这一些建议? 谢谢:)
Anyone can give me some advise about this? Thank you :)
推荐答案
1)在你的HTML文件中,已ü把此行中< HEAD>
1) In your html file, have u put this line on <head>
?
<script type="text/javascript" charset="utf-8" src="cordova-1.8.1.js"></script>
2)加入该行会在活动前
2) Add this line on top of your activity
import org.apache.cordova.*;
3)。你从科尔多瓦下载复制科尔多瓦-1.8.1.jar
更早的进入文件夹 /库
3) Have you copy cordova-1.8.1.jar
from your Cordova download earlier into folder /libs
4)你有没有配置项目构建路径?
4) Have you configure project Build Path?
右键点击 /库
文件夹,然后转到构建路径/>配置
构建路径 ....然后,在库选项卡,添加科尔多瓦-1.8.1.jar
来
该项目
Right click on the
/libs
folder and go to Build Paths/ > Configure Build Path.... Then, in the Libraries tab, addcordova-1.8.1.jar
to the project
5)你有没有复制 cordova.xml
和 plugins.xml
从早期到文件夹中的科尔多瓦下载文件 / RES / XML
5) Have you copy cordova.xml
and plugins.xml
file from your Cordova download earlier into folder /res/xml
这是你的检查清单。希望它能帮助。
This is your check list. Hope it help.
这篇关于PhoneGap的1.8.1 - super.loadUrl(&QUOT;文件:///android_asset/www/index.html")问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!