模拟器的位置模拟不起作用 [英] Emulator's Location simulation not working

查看:43
本文介绍了模拟器的位置模拟不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的应用程序的最低 API 级别从 5.0(Lollipop)降低到 4.4(KitKat)

遗憾的是我无法获得任何真实设备,所以我必须使用模拟器.

我的应用很大程度上基于用户的位置,因此主要测试必须针对位置更改功能.

我尝试在 官方 Google Android 模拟器中使用位置模拟.(x86)

我制作了一个 4.4 模拟器并且工作正常,我的应用程序工作正常但是当我尝试通过扩展控制面板发送位置时没有任何反应.

如果我加载 GPX 文件,位置会出现在 GPS 数据播放内扩展控制面板的表格上,但设备没有获取任何位置.>

我填写了经纬度点击发送"但没有任何反应.

我还尝试从 Android 设备监视器的模拟器控制" 标签中模拟位置更改

发送"按钮根本无法点击,long 和 lat 字段被禁用,我无法填写任何内容.GPX"和KML"标签也被禁用.

我还尝试了使用 Gps Emulator 插件,如下所示:

进度条确实增加了,所以不像我尝试过的前两种方法,这最终看起来像是在做一些事情但模拟器仍然没有得到位置变化. 完全没有.

我已经通过命令行尝试了第四种方法:

telnet 本地主机 5554

但我有连接被拒绝错误信息.

所以我不能尝试通过以下方式发送位置:

geo fix <纬度值>

(我的 Windows 上启用了 Telnet)

解决方案

我在使用 SDK 工具 25.1.7 版时遇到了同样的问题.我已将它们更新为 25.2 rc1,现在可以使用了.

请注意,您无法从 Android Studio 安装 RC 版本.您必须启动单独的 Android SDK 管理器才能看到它.

重新启动模拟器并在扩展控件"窗口的帮助/关于"屏幕中检查您确实使用的是最新版本.

I would like to lower the minimum API level of my application to 4.4(KitKat) from 5.0(Lollipop)

Sadly I couldn't get any real devices so I have to work with an emulator.

My app is heavily based on user's location so the main testing must be target the location changing feature.

I try to use location simulation with the official Google Android Emulator. (x86)

I have made a 4.4 Emulator and is working fine, my app works fine but when I try to send locations via the Extended control panel nothing happens.

If I load a GPX file the locations appear on the table of the extended control panel inside the GPS data playback but the device does not get any locations.

I fill the lat and longitude click on "SEND" but nothing happens.

I have also tried to simulate location changing from the Android Device Monitor's "Emulator Control" tab

The "Send" button is not clickable at all, the long and lat fields are disabled and I cannot fill anything. The "GPX" and "KML" tabs are also disabled.

I have also tried to use the Gps Emulator plugin as the following:

The progress bar do increases, so not like the first 2 methods I have tried this is finally looks like actually doing something but the emulator still not getting the location changes. Not at all.

I have tried a fourth method via command line:

telnet localhost 5554

But I have Connection refused error message.

So I cannot try to send locations via:

geo fix <longitude value> <latitude value>

(Telnet is enabled on my Windows)

解决方案

I had the same problem with the SDK Tools version 25.1.7. I've updated them to 25.2 rc1 and it now works.

Beware that you cannot install the RC version from Android Studio. You have to launch the separate Android SDK Manager to see it.

Relaunch the emulator and check that you are indeed using the latest version in the Help/About screen of the Extended Controls windows.

这篇关于模拟器的位置模拟不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆