Bug 42348 - Crash due to missing permissions
Summary: Crash due to missing permissions
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-07-04 16:58 UTC by Jean
Modified: 2016-07-13 14:14 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 42348 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Jean 2016-07-04 16:58:40 UTC
The app should not crash, at most display an error:

java.lang.SecurityException: Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations.
	at android.os.Parcel.readException(Parcel.java:1620)
	at android.os.Parcel.readException(Parcel.java:1573)
	at ub.a(:com.google.android.gms.DynamiteModulesB:1191)
	at to.a(:com.google.android.gms.DynamiteModulesB:2110)
	at lw.b(:com.google.android.gms.DynamiteModulesB:148)
	at ml.b(:com.google.android.gms.DynamiteModulesB:1164)
	at nf.b(:com.google.android.gms.DynamiteModulesB:260)
	at na.b(:com.google.android.gms.DynamiteModulesB:324)
	at tn.a(:com.google.android.gms.DynamiteModulesB:78)
	at maps.af.L.a(Unknown Source)
	at na.a(:com.google.android.gms.DynamiteModulesB:13201)
	at mo.g(:com.google.android.gms.DynamiteModulesB:499)
	at mo.a(:com.google.android.gms.DynamiteModulesB:435)
	at mh.a(:com.google.android.gms.DynamiteModulesB:1437)
	at pj.a(:com.google.android.gms.DynamiteModulesB:227)
	at oz.a(:com.google.android.gms.DynamiteModulesB:780)
	at oq.a(:com.google.android.gms.DynamiteModulesB:1829)
	at ot.handleMessage(:com.google.android.gms.DynamiteModulesB:5339)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:5461)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Comment 1 Jonathan Pryor 2016-07-04 18:04:48 UTC
> The app should not crash

What app? Your app? A sample app?

Throwing exceptions when permissions are lacking is how Android works. If the app should "not crash, at most display an error," that is up to the app to implement.

Based on the stack trace, it looks like it's Google's Maps library which is triggering the exception, and it might not have a way to "display an error."
Comment 2 Jean 2016-07-05 03:45:14 UTC
Yes it is my app, in prod, and few users have this issue.

Yes, as you see, there is no user code involved in the stack.
I don't think Android does not provide a mechanism to catch unhandled exceptions, therefore as a developer it seems impossible to catch anything.

Is there any way to solve this issue?
Comment 3 Jonathan Pryor 2016-07-06 17:20:58 UTC
> Is there any way to solve this issue?

Yes: appease Google Maps. Add ACCESS_FINE_LOCATION to your AndroidManifest.xml, *or* don't request PRIORITY_HIGH_ACCURACY. (I don't know if it's possible to ask Google Maps to not request PRIORITY_HIGH_ACCURACY, but if it is possible then that would fix the problem...)
Comment 4 Jean 2016-07-10 11:58:46 UTC
Unfortunately this is already in the manifest:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

So I am a bit lost :(
Comment 5 Jonathan Pryor 2016-07-13 14:14:55 UTC
This might be relevant:


For example, if your targetSdkVersion is 23 or higher and you're on an Android 6.0 target, you need to participate in the new Android 6.0 runtime permission system.