09-08 21:14:26.890: E/ThreadApHelper(22579): Cannot get WiFi AP state
09-08 21:14:26.890: E/ThreadApHelper(22579): java.lang.reflect.InvocationTargetException
09-08 21:14:26.890: E/ThreadApHelper(22579): at java.lang.reflect.Method.invokeNative(Native Method)
09-08 21:14:26.890: E/ThreadApHelper(22579): at java.lang.reflect.Method.invoke(Method.java:507)
09-08 21:14:26.890: E/ThreadApHelper(22579): at com.leranxinsheng.net.ThreadApHelper.getWifiApState(ThreadApHelper.java:125)
09-08 21:14:26.890: E/ThreadApHelper(22579): at com.leranxinsheng.net.ThreadApHelper.isApEnabled(ThreadApHelper.java:138)
09-08 21:14:26.890: E/ThreadApHelper(22579): at com.leranxinsheng.activity.BottomMenuActivity$1.onReceive(BottomMenuActivity.java:69)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.os.Handler.handleCallback(Handler.java:587)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.os.Handler.dispatchMessage(Handler.java:92)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.os.Looper.loop(Looper.java:130)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-08 21:14:26.890: E/ThreadApHelper(22579): at java.lang.reflect.Method.invokeNative(Native Method)
09-08 21:14:26.890: E/ThreadApHelper(22579): at java.lang.reflect.Method.invoke(Method.java:507)
09-08 21:14:26.890: E/ThreadApHelper(22579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-08 21:14:26.890: E/ThreadApHelper(22579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-08 21:14:26.890: E/ThreadApHelper(22579): at dalvik.system.NativeStart.main(Native Method)
09-08 21:14:26.890: E/ThreadApHelper(22579): Caused by: java.lang.SecurityException: WifiService: Neither user 10104 nor current process has android.permission.ACCESS_WIFI_STATE.
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.os.Parcel.readException(Parcel.java:1322)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.os.Parcel.readException(Parcel.java:1276)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.net.wifi.IWifiManager$Stub$Proxy.getWifiApEnabledState(IWifiManager.java:923)
09-08 21:14:26.890: E/ThreadApHelper(22579): at android.net.wifi.WifiManager.getWifiApState(WifiManager.java:826)
09-08 21:14:26.890: E/ThreadApHelper(22579): ... 15 more
09-08 21:14:26.890: D/AndroidRuntime(22579): Shutting down VM
原因是:没有访问WIFI状态的权限(ACCESS_WIFI_STATE)。
在AndroidManifest.xml里面加上
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
就行了。
本文转自陈哈哈博客园博客,原文链接http://www.cnblogs.com/kissazi2/archive/2012/09/08/2677053.html如需转载请自行联系原作者
kissazi2