简体   繁体   English

Android模拟器无法检测GPS

[英]Android Emulator does not detect GPS

I am trying to test an Android application that does GPS tracking. 我正在尝试测试执行GPS跟踪的Android应用程序。 Unfortunately, I get the following error when installing the app on the emulator: 不幸的是,在模拟器上安装应用程序时出现以下错误:

Package: com.google.android.maps.appname requires unavailable feature android.hardware.location.gps; failing!

The virtual device that I am using is "Google APIs (Google Inc.) 8" and I made sure that GPS was included in the hardware list. 我使用的虚拟设备是“Google API(Google Inc.)8”,我确保GPS已包含在硬件列表中。

The error above I believe happens at the following point in the manifest: 我认为上面的错误发生在清单中的以下点:

<uses-feature android:name="android.hardware.location.gps" android:required="true"/>

Does anyone know what the cause of this error might be and what I can do to fix it? 有谁知道这个错误的原因可能是什么以及我可以做些什么来解决它?

You can change the android:required="true" to "false", and it'll let it install. 您可以将android:required =“true”更改为“false”,并将其安装。 I don't know why it doesn't think the feature is available. 我不知道为什么它不认为该功能可用。

Also, for me this only happens when the target of the AVD is API level 8+. 另外,对我来说,只有当AVD的目标是API等级8+时才会发生这种情况。 So as a workaround, if you are not using something new in 2.2, you may be able to use API level 7 instead (ie set the target of the AVD to "Google APIs (Google Inc.) 7"). 因此,作为一种解决方法,如果您没有在2.2中使用新功能,则可以使用API​​级别7(即将AVD的目标设置为“Google API(Google Inc.)7”)。

I was running into the same issue using SDK tools r11. 我使用SDK工具r11遇到了同样的问题。 Problem was that I just had the uses-feature attribute as "required" and not "android:required". 问题是我只是将uses-feature属性设置为“required”而不是“android:required”。 Doesn't look like it is the same issue you had, but it does at least appear to be fixed. 看起来不像你有同样的问题,但它至少看起来是固定的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM