OnLocationStateChange cordova应用程序崩溃 [英] OnLocationStateChange cordova application crashes

查看:433
本文介绍了OnLocationStateChange cordova应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的应用程序基本上是使用cordova geolocation插件获取用户位置,然后在google地图上显示位置。

The application i am working is basically fetches users location using cordova geolocation plugin, and then show the location on the google maps.

我面临的问题是当我杀死应用程序并关闭/ on位置服务从设置应用程序崩溃。

The problem i'm facing is that when i kill the app and turn off/on the location services from settings the application crashes.


java.lang.RuntimeException:启动接收者cordova.plugins.Diagnostic $ LocationProviderChangedReceiver:java.lang.NullPointerException:尝试在空对象引用上调用虚拟方法void cordova.plugins.Diagnostic.notifyLocationStateChange()

java.lang.RuntimeException: Unable to start receiver cordova.plugins.Diagnostic$LocationProviderChangedReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'void cordova.plugins.Diagnostic.notifyLocationStateChange()' on a null object reference

Caused by:java.lang.NullPointerException:尝试在空对象引用上调用虚拟方法void cordova.plugins.Diagnostic.notifyLocationStateChange()

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void cordova.plugins.Diagnostic.notifyLocationStateChange()' on a null object reference


这是我从Android studio直接运行应用程序后得到的错误屏幕截图

this is the screen shot of error that i got after running the app directly from Android studio

我也使用诊断插件,因为我测试应用程序在API 23即Marshmallow,需要运行时权限。如果我删除诊断插件应用程序崩溃,一旦它开始在Marshmallow。

I'm using diagnostic plugin as well because i'm testing app on API 23 i-e Marshmallow, that needs run time permissions. if i remove diagnostic plugin the app crashes as soon as it starts on Marshmallow.

应用程序运行在API的23下,也不会崩溃,当我打开位置服务开/ Off。

The app runs on API's below 23 and also it does not crashes when i turn location services On/Off.

欢迎提出建议。

推荐答案

问题#85 ://github.com/dpa99c/cordova-diagnostic-pluginrel =nofollow noreferrer>插件repo ,并由补丁版本解决 cordova.plugins.diagnostic@3.0.4

This is noted as issue #85 in the plugin repo and is resolved by patch release cordova.plugins.diagnostic@3.0.4:

$ cordova plugin rm cordova.plugins.diagnostic && 
  cordova plugin add cordova.plugins.diagnostic@latest

这篇关于OnLocationStateChange cordova应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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