我正在尝试测试我的应用程序,它使用模拟器使用地理定位。介绍了几种方法here https://stackoverflow.com/questions/2279647/how-to-emulate-gps-location-in-the-android-emulator。我要去Window->Open Perspective->DDMS
,然后输入纬度。又长。一进Location Controls
然后我点击“发送”。
但这不起作用。相反,我看到以下错误:Unable to send command to the emulator.
为什么会出现这种情况!?
我不认为我的应用程序有问题,因为我使用模拟器的默认浏览器进行了测试,并且它也无法访问位置信息。
细节:
- 操作系统 10.9.4
- AVD_for_Nexus_4_by_Google 定位 v4.4.2
- 面向 Android 开发人员的 Eclipse IDE 23.0.2.1259578
Update:我改为AVD_for_Galaxy_Nexus_by_Google
它仍然不起作用,但我不再看到该错误。我点击发送,但没有任何反应。
Update2:我已经测试过使用 Telnet 将位置数据传递到模拟器,但同样没有任何反应。没有错误。根本不值一提。呃!
telnet localhost 5554
geo fix 50 50
它的响应是OK
但什么也没发生。仍然没有可用的位置数据。
Update3:我注意到 LogCat 中出现一系列以下错误
09-20 17:58:59.910: E/eglCodecCommon(1777): glUtilsParamSize: unknow param 0x00000b44
09-20 17:58:59.910: E/eglCodecCommon(1777): glUtilsParamSize: unknow param 0x00000bd0
09-20 17:58:59.930: E/eglCodecCommon(1777): **** ERROR unknown type 0x0 (glSizeof,72)
该应用程序似乎运行良好,这些错误据说已得到解释here https://stackoverflow.com/questions/22348801/phonegap-eclipse-issue-eglcodeccommon-glutilsparamsize-unknow-param-errors.
Update 4:
I've seen multiple suggestions to confirm that my AVD has GPS Support enabled, but this option/setting does not appear anywhere. When I open the "Android Virtual Device Manager" and then click "Edit" on one of my devices, this is what I see:
没有提及“GPS 支持”。
更新5:我检查了所有 AVD 的 config.ini 文件,它们都正确设置为hw.gps=yes
。我还使用 Google API 目标创建了 AVD,但仍然遇到同样的问题。该应用程序已加载,但没有可用的位置数据,可使用“位置控制”和 telnet。
Update 6:
Following Gyebro's suggestions below... trying to load his LocationDemo app...
这是我在 LogCat 中看到的内容: