WiFi扫描没有这样的实例字段'ChannelWidth'

时间:2016-06-14 00:57:09

标签: java android wifi wireless

使用

wifiManager.startScan();
ScanResultsList scanresultsList = wifiManager.getScanResults();

我获取了ScanResult个对象定义的扫描结果列表。

问题:

参考scanResult.channelWidth我收到了错误消息:

scanResult.channelWidth = No such instance field: 'channelWidth'

异常

  

java.lang.NoSuchFieldError:没有类型I的实例字段channelWidth   在课堂上Landroid / net / wifi / ScanResult;或者它的超类   ('android.net.wifi.ScanResult'的声明出现在   /system/framework/framework.jar)

堆栈跟踪:

06-14 02:57:19.732 27116-27116/com.cynetstudios.frequencyselector E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cynetstudios.frequencyselector, PID: 27116
java.lang.NoSuchFieldError: No instance field channelWidth of type I in class Landroid/net/wifi/ScanResult; or its superclasses (declaration of 'android.net.wifi.ScanResult' appears in /system/framework/framework.jar)
    at com.cynetstudios.frequencyselector.main.initWiFiArrays(main.java:161)
    at com.cynetstudios.frequencyselector.main.access$000(main.java:35)
    at com.cynetstudios.frequencyselector.main$1$1.run(main.java:115)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5291)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

我需要这个int值进行进一步处理,

是什么导致这个没有实例字段?

1 个答案:

答案 0 :(得分:0)

这可能很有用,请查看此链接 https://developer.android.com/reference/android/net/wifi/ScanResult.html>