question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.SecurityException: Permission Denial

See original GitHub issue

I added <uses-permission android:name="android.permission.READ_CONTACTS" /> to AndroidManifest.xml, but I still get

+2189 ms] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): Failed to handle method call
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{cee4cc6 20983:com.lookatyou.lookatmybaby/u0a377} (pid=20983, uid=10377) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.os.Parcel.readException(Parcel.java:2004)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.os.Parcel.readException(Parcel.java:1950)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:4758)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.app.ActivityThread.acquireProvider(ActivityThread.java:5836)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2526)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1780)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.content.ContentResolver.query(ContentResolver.java:738)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.content.ContentResolver.query(ContentResolver.java:704)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.content.ContentResolver.query(ContentResolver.java:662)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.getCursor(ContactsServicePlugin.java:123)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.getContacts(ContactsServicePlugin.java:107)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.onMethodCall(ContactsServicePlugin.java:49)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:136)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.os.MessageQueue.nativePollOnce(Native Method)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.os.MessageQueue.next(MessageQueue.java:325)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.os.Looper.loop(Looper.java:142)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at android.app.ActivityThread.main(ActivityThread.java:6494)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at java.lang.reflect.Method.invoke(Native Method)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
[        ] E/MethodChannel#github.com/clovisnicolas/flutter_contacts(20983): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
[  +25 ms] I/flutter (20983): 598 2018-04-05 15:28:39.239197 SEVERE lookatmybaby_flutter.sentry_error_reporter: 
[   +1 ms] I/flutter (20983):     error: PlatformException(error, Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{cee4cc6 20983:com.lookatyou.lookatmybaby/u0a377} (pid=20983, uid=10377) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS, null)
[   +4 ms] I/flutter (20983): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:544:7)
[        ] I/flutter (20983): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:154:18)
[        ] I/flutter (20983): <asynchronous suspension>
[        ] I/flutter (20983): #2      ContactsService.getContacts (package:contacts_service/contacts_service.dart:13:45)
[        ] I/flutter (20983): <asynchronous suspension>
[        ] I/flutter (20983): #3      InvitationDaoFirebase.loadContacts (package:lookatmybaby_flutter/src/server_api_firebase/invitation_dao_firebase.dart:140:50)
[        ] I/flutter (20983): <asynchronous suspension>
[        ] I/flutter (20983): #4      new InvitationController (package:lookatmybaby_shared/src/client/controller/invitation_controller.dart:27:26)
[        ] I/flutter (20983): #5      AppController.invitationController (package:lookatmybaby_shared/src/client/controller/app_controller.dart:241:37)
[        ] I/flutter (20983): #6      _InvitePeopleScreenState.controller (package:lookatmybaby_flutter/widgets/screens/invite_people_screen/invite_people_screen.dart:27:56)
[        ] I/flutter (20983): #7      ScreenState._buildAppBarCallback (package:lookatmybaby_flutter/widgets/generic_widgets/screen_state.dart:134:16)
[        ] I/flutter (20983): #8      SearchBar.bu
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v0.2.2-pre.7, on Mac OS X 10.13.3 17D102, locale en-AT)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
[✓] Android Studio (version 3.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1)
[✓] Connected devices (2 available)

Do you have any idea how to fix that?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
freewheelnatcommented, Apr 13, 2018

There seems to be a new plugin https://github.com/Ethras/flutter_simple_permissions . It looks incomplete though - no “shouldShowRationale” for Android, and only a subset of permissions supported for now. I wrote a tutorial about Android permissions in Flutter ( http://cogitas.net/android-runtime-permission-flow-flutter/ ) so I’m going to see if I can improve that plugin for the Android side, as it would be great to have a plugin handling this.

2reactions
freewheelnatcommented, May 1, 2018

Following from my previous comment, I have done the PR to add Android contact permissions (read/write) to the simple_permissions plugin; the maintainer has now done the iOS code and has published an updated version of the plugin. Therefore, I would recommend using that plugin.

I will work on the PR for “shouldShowRationale” flow soon (see my comment above), but I prioritised the PR for adding contacts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.SecurityException: Permission Denial: starting Intent
So I ran into this problem recently. The issue was in the build/run configuration. Apparently android studio had chosen an activity in my ......
Read more >
Permission Denial: starting Intent… java.lang.SecurityException
Marcia: your issue seems to be that Boingo Wi-Finder is somehow associated as the handler for that file, but the intent handler isn't...
Read more >
java.lang.SecurityException: Permission Denial: starting Intent ...
I am an Appium and Android noob, thrown into a startup and asked to build their Appium testing for iOS and Android.
Read more >
Fails to run: `Security exception: Permission Denial: starting ...
Today I've updated Flutter and a bunch of packages. barcode_scan stopped working after this. When trying to build the project I get: ...
Read more >
Permission denial: writing to settings requires:android ...
java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found