Caused by: java.lang.UnsupportedOperationException: Exceeded maximum number of wifi locks
来源:互联网 发布:淘宝抢单神器软件 编辑:程序博客网 时间:2024/06/05 07:35
问题如下:
Caused by: java.lang.UnsupportedOperationException: Exceeded maximum number of wifi locks
问题原因:
先看代码如下:
WifiManager manager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);WifiManager.MulticastLock lock= manager.createMulticastLock("test wifi");lock.acquire();//申请广播开启lock.release();//释放
报错原因是:lock.acquire() 和 lock.release(),没有匹配对应使用.
即调用acquire()方法用完之后,没有及时调用release()方法。
若只调用acquire()方法,调用50次后程序必崩溃,报如下错误:
E/AndroidRuntime(7742): FATAL EXCEPTION: Timer-0
E/AndroidRuntime(7742): java.lang.UnsupportedOperationException: Exceeded maximum number of wifi locks
E/AndroidRuntime(7742): at android.net.wifi.WifiManager$MulticastLock.acquire(WifiManager.java:1139)
E/AndroidRuntime(7742): at sunny.fans.WifiTest$1$1.run(WifiTest.java:53)
E/AndroidRuntime(7742): at java.util.Timer$TimerImpl.run(Timer.java:284)
测试三款手机,中兴、HTC及华为手机,调用50次acquire(),没有调用release()都会报如上错误。
小结:以后在调用WifiManager.MulticastLock来发送广播接收报文时,
记得acquire()方法和release()方法要匹配调用。
参考网址:
http://developer.android.com/reference/android/net/wifi/WifiManager.MulticastLock.html
http://blog.csdn.net/lvron/article/details/6606755
- Caused by: java.lang.UnsupportedOperationException: Exceeded maximum number of wifi locks
- Caused by: java.lang.UnsupportedOperationException
- Caused by: java.lang.UnsupportedOperationException
- java.lang.IllegalArgumentException: Maximum number of fonts was exceeded解决
- java.lang.IllegalStateException: The maximum number of cell styles was exceeded
- java.lang.IllegalStateException: The maximum number of cell styles was exceeded.
- java.lang.IllegalStateException: The maximum number of cell styles was exceeded. You can define up t
- Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
- Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
- bug宝典JAVA篇 Proguard混淆 [proguard] Caused by: java.lang.UnsupportedOperationException: Unsupported cla
- Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
- Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- Android问题解决:Caused by: java.lang.UnsupportedOperationException: Can't convert to fraction: type=0x3
- Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 75 to dimension
- Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x1
- Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- day01XML(1)
- 【动归】rainbow与freda染旗
- 一个数组中除了三个数字,其余数字都出现两次,求出这三个数字
- linux内核调度算法(1)--快速找到最高优先级进程
- js showModalDialog弹出对话框
- Caused by: java.lang.UnsupportedOperationException: Exceeded maximum number of wifi locks
- C语言算法--插入排序
- linux内核调度算法(2)--CPU时间片如何分配
- java设计模式-责任链模式(Chain Of Resposibility)
- day02XML2+JUNIT+Properties
- static ---静态成员函数
- 黑客是如何黑我的电脑的
- 在web.xml中配置404错误拦截
- 问题列表