在这篇文章中,我们将为您详细介绍android-emulator–AndroidGeolocation无法在模拟器中获取您的位置错误的内容,并且讨论关于模拟器无法获取位置信息的相关问题。此外,我们还会
在这篇文章中,我们将为您详细介绍android-emulator – Android Geolocation无法在模拟器中获取您的位置错误的内容,并且讨论关于模拟器无法获取位置信息的相关问题。此外,我们还会涉及一些关于Android Emulator 是否包含 Android SDK 或 Android Studio?、Android Emulator未在Android Studio 3.0上运行、android getlastknownlocation在模拟器中始终为null、Android Studio 0.9.2中Android Emulator的屏幕截图的知识,以帮助您更全面地了解这个主题。
本文目录一览:- android-emulator – Android Geolocation无法在模拟器中获取您的位置错误(模拟器无法获取位置信息)
- Android Emulator 是否包含 Android SDK 或 Android Studio?
- Android Emulator未在Android Studio 3.0上运行
- android getlastknownlocation在模拟器中始终为null
- Android Studio 0.9.2中Android Emulator的屏幕截图
android-emulator – Android Geolocation无法在模拟器中获取您的位置错误(模拟器无法获取位置信息)
application.Ti.App.GeoApp = {}; Ti.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS; Ti.Geolocation.purpose = "testing"; Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; Titanium.Geolocation.distanceFilter = 10; if( Titanium.Geolocation.locationServicesEnabled === false ) { Ti.API.debug(''Your device has GPS turned off. Please turn it on.''); } function updatePosition(e) { if( ! e.success || e.error ) { alert("Unable to get your location."); Ti.API.debug(JSON.stringify(e)); Ti.API.debug(e); return; } Ti.App.fireEvent("app:got.location",{ "coords" : e.coords }); }; Ti.App.addEventListener("app:got.location",function(d) { Ti.App.GeoApp.f_lng = d.longitude; Ti.App.GeoApp.f_lat = d.latitude; Ti.API.debug(JSON.stringify(d)); Ti.Geolocation.removeEventListener(''location'',updatePosition); alert(JSON.stringify(d)); }); Titanium.Geolocation.getCurrentPosition( updatePosition ); Titanium.Geolocation.addEventListener( ''location'',updatePosition );
运行此代码后,它提供警报*无法获取您的位置.*在Android模拟器中
我错过了什么?提前致谢
解决方法
`
telnet localhost 5554(考虑到有时端口不同 – 你可以在窗口标题栏中看到它).
试试127.0.0.1 ……
连接到localhost.
逃脱角色是’^]’.
Android控制台:输入“帮助”以获取命令列表
好
geo fix 15.4548 12.4548(参数是经度,纬度(以度为单位))
好
放弃
`
请享用
Android Emulator 是否包含 Android SDK 或 Android Studio?
来自Android Emulator release notes
Android 模拟器包含在 Android Studio 中。
25.3.0 之前的模拟器版本作为 Android SDK 工具。
为确保您拥有最新版本,请检查 SDK Manager 更新。
对于 25.3.0 之前的 Android Emulator 版本,请参阅 Android SDK 工具发行说明。
Android Emulator未在Android Studio 3.0上运行
在这里,您可以看到我创建了一台名为Nexus 5X的avd机器,我捕获了已创建机器的详细信息,在这里您可以看到:
Name: Nexus_5X_API_25 cpu/ABI: Google Apis Intel Atom (x86) Path: C:\Users\williams\.android\avd\Nexus_5X_API_25.avd Target: google_apis [Google Apis] (API level 25) Skin: nexus_5x SD Card: C:\Users\williams\.android\avd\Nexus_5X_API_25.avd\sdcard.img hw.dPad: no runtime.network.speed: full hw.accelerometer: yes hw.device.name: Nexus 5X vm.heapSize: 256 skin.dynamic: yes hw.device.manufacturer: Google hw.gps: yes hw.initialOrientation: Portrait image.androidVersion.api: 25 hw.audioInput: yes image.sysdir.1: system-images\android-25\google_apis\x86\ tag.id: google_apis showDeviceFrame: yes hw.camera.back: emulated hw.mainKeys: no AvdId: Nexus_5X_API_25 hw.camera.front: emulated hw.lcd.density: 420 avd.ini.displayname: Nexus 5X API 25 hw.gpu.mode: guest hw.device.hash2: MD5:1be89bc42ec9644d4b77968b23474980 hw.ramSize: 1536 hw.trackball: no PlayStore.enabled: false hw.battery: yes hw.cpu.ncore: 2 hw.sdCard: yes tag.display: Google Apis runtime.network.latency: none hw.keyboard: yes hw.sensors.proximity: yes disk.dataPartition.size: 800M hw.sensors.orientation: yes avd.ini.encoding: UTF-8 hw.gpu.enabled: yes
这是SDK工具快照:
好吧,当我运行这个模拟器时,我正面临一些挑战.当我点击这个模拟器的运行按钮时,它什么也没做.
以下是错误日志:
Emulator: Could not launch 'C:\Users\williams\AppData\Local\Android\Sdk\emulator/qemu/windows-x86_64/qemu-system-i386.exe': No such file or directory Emulator: [12360]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at C:\Users\williams\AppData\Local\Android\Sdk\emulator\lib64\qt\lib Emulator: Process finished with exit code 2
有人能说出这个配置有什么问题吗?顺便说一句,我已经检查了这些Emulator in Android Studio doesn’t start但没有运气.
解决方法
android getlastknownlocation在模拟器中始终为null
这似乎是一个常见的问题,但是即使我读了很多类似的问题,我也真的不明白为什么会这样。
我正在模拟器设备上使用基本的位置类,我设置了所有内容-
权限(FINE和COARSE),在DDMS中设置了坐标,我也尝试使用telnet,然后尝试,但是无论什么总是崩溃,都会导致nullpointer与getlastknownlocation有关的异常,这里有什么主意吗?
public class MainActivity extends Activity implements LocationListener {private static LocationManager ok;private Location L;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ok=(LocationManager)this.getSystemService(ok.GPS_PROVIDER); L=ok.getLastKnownLocation(ok.GPS_PROVIDER);}@Overridepublic void onLocationChanged(Location Loc) { try { double latop=Loc.getLatitude(); double longe=Loc.getLongitude(); Log.i("OK", "and"+longe+""+latop); } catch (NullPointerException e) { }}
答案1
小编典典getLastKnownLocation()``null
如果最近没有应用向您希望的提供商请求位置修复,则通常会返回。
在模拟器上,它似乎更进一步:除非您的应用程序已调用,否则您将无法获得位置,除非已将位置传递给模拟器requestLocationUpdates()
。
对于使用通用的模式getLastKnownLocation()
,如果你想获得一个实际的体面的赔率Location
,是使用requestLocationUpdates()
和removeLocationUpdates()
确保LocationManager
正在积极寻求通过您所选择的供应商的位置。当然,如果您这样选择的话,也可以使用LocationListener
和onLocationChanged()
,而不是getLastKnownLocation()
。
Android Studio 0.9.2中Android Emulator的屏幕截图
解决方法
步:
>打开Android虚拟设备管理器.
>单击模拟器的“编辑”图标.
>在“模拟性能”上,取消选中“使用主机GPU”
>单击“完成”并再次启动模拟器.
一切都会正常.
关于android-emulator – Android Geolocation无法在模拟器中获取您的位置错误和模拟器无法获取位置信息的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Android Emulator 是否包含 Android SDK 或 Android Studio?、Android Emulator未在Android Studio 3.0上运行、android getlastknownlocation在模拟器中始终为null、Android Studio 0.9.2中Android Emulator的屏幕截图的相关信息,请在本站寻找。
本文标签: