问题描述
好吧,我想让演示在他们的网站上运行,但是当我尝试安装它并在我的手机上运行时,我在Eclipse中得到这个异常:
05-01 13:10:49.637:E / AndroidRuntime(19669):java.lang.SecurityException:ConnectivityService:用户10128或当前进程都没有android.permission.ACCESS_NETWORK_STATE。
我想也许是因为它是在WiFi上,但是在我禁用它之后它仍然存在。有没有人知道是什么原因?我实际上做了最低限度。这是我的HTML:
<!DOCTYPE HTML>
< html>
< head>
< title> PhoneGap< / title>
< script type =text / javascriptcharset =utf-8src =cordova-1.7.0rc1.js>< / script>
< / head>
< body>
< h1> Hello World< / h1>
< / body>
< / html>
我想出来了,这个。
基本上,你必须添加一行到androidmanifest.xml文件的权限。在eclipse中,您只需要添加:
android.permission.ACCESS_NETWORK_STATE
由于显然不清楚,这是为了蚀。 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.
这篇关于你好世界phonegap应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!