且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

你好世界phonegap应用程序崩溃

更新时间:2023-02-03 09:34:24

我想出来了,这个。



基本上,你必须添加一行到androidmanifest.xml文件的权限。在eclipse中,您只需要添加:



android.permission.ACCESS_NETWORK_STATE

$ b $




由于显然不清楚,这是为了蚀。 Eclipse有一个很好的编辑器,将允许您通过下拉菜单添加属性。您仍然可以进入并手动添加条目到清单文件中。这很简单。


Alright, I am trying to just get the demo working on their website, but when I try to install it and run on my phone, I get this exception in Eclipse:

05-01 13:10:49.637: E/AndroidRuntime(19669): java.lang.SecurityException: ConnectivityService: Neither user 10128 nor current process has android.permission.ACCESS_NETWORK_STATE.

I thought maybe it was because it was on WiFi, but it persisted after I disabled that as well. Does anyone know what is causing this? I am literally doing the bare minimum. This is my HTML:

<!DOCTYPE HTML>
<html>
<head>
   <title>PhoneGap</title>
   <script type="text/javascript" charset="utf-8" src="cordova-1.7.0rc1.js"></script>
</head>
<body>
   <h1>Hello World</h1>
</body>
</html>

I figured it out, like 3 seconds after I posted this.

Basically, you have to add a line to the androidmanifest.xml file to the permissions. In eclipse, you just need to add this:

android.permission.ACCESS_NETWORK_STATE

and that did the trick!


Since apparently this is not clear, THIS IS FOR ECLIPSE. Eclipse has a nice editor which will allow you to add properties via a dropdown menu. You can still go in and manually add entries into the manifest file. This is much simpler though.