Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Activity.getSystemService-Android-5.1.1上的应用程序崩溃_Android_Android Service - Fatal编程技术网

Activity.getSystemService-Android-5.1.1上的应用程序崩溃

Activity.getSystemService-Android-5.1.1上的应用程序崩溃,android,android-service,Android,Android Service,使用context.getSystemService获取系统服务实例时,我的应用程序随机崩溃。只有在android 5.1.1和M上才能观察到这种崩溃 我正在使用下面的代码获取location manager实例,但它崩溃了 LocationManager manager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); 下面是相同的堆栈跟踪: java.lang.IllegalStateExcep

使用context.getSystemService获取系统服务实例时,我的应用程序随机崩溃。只有在android 5.1.1和M上才能观察到这种崩溃

我正在使用下面的代码获取location manager实例,但它崩溃了

 LocationManager manager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
下面是相同的堆栈跟踪:

java.lang.IllegalStateException: Parcel has been finalized!
    at android.os.BinderProxy.transactNative(Native Method)
    at android.os.BinderProxy.transact(Binder.java:511)
    at android.os.ServiceManagerProxy.getService(ServiceManagerNative.java:123)
    at android.os.ServiceManager.getService(ServiceManager.java:55)
    at android.app.ContextImpl$27.createService(ContextImpl.java:538)
    at android.app.ContextImpl$ServiceFetcher.getService(ContextImpl.java:341)
    at android.app.ContextImpl.getSystemService(ContextImpl.java:2079)
    at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:113)
    at android.app.Activity.getSystemService(Activity.java:5233)

更新您的SDK,我相信您的问题会得到解决。

因为我在将android版本从5.0升级到5.1.1时遇到了同样的问题,我的应用程序在尝试登录时崩溃。

更新您的SDK,我相信您的问题会得到解决。

因为我的android版本从5.0升级到5.1.1时遇到了同样的问题,当我尝试登录时,我的应用程序崩溃了。

你想实例化哪个服务?你能通过显示代码来扩展问题吗?你是否在清单文件中定义了权限?是,its在5.1.1下工作,在5.1.1下工作,随机崩溃不总是你试图实例化哪个服务?你能通过显示代码来扩展问题吗?你是否在清单文件中定义了权限?是的,its在5.1.1下工作,在5.1.1下工作,随机崩溃不总是