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.

flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.getCursor

See original GitHub issue

Getting following error:

java.lang.NullPointerException

flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.getCursor

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
       at android.os.AsyncTask$3.done(AsyncTask.java:355)
       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
       at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
       at java.util.concurrent.FutureTask.run(FutureTask.java:271)
       at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:784)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.Cursor android.content.ContentResolver.query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String)' on a null object reference
       at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.getCursor(ContactsServicePlugin.java:104)
       at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.access$500(ContactsServicePlugin.java)
       at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin$GetContactsTask.doInBackground(ContactsServicePlugin.java:81)
       at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin$GetContactsTask.doInBackground(ContactsServicePlugin.java)
       at android.os.AsyncTask$2.call(AsyncTask.java:334)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:784)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Hwan-seokcommented, Oct 14, 2021

@lukasgit I think this is reoccurring, Our users are facing this issue in production. contact_service version : 0.6.3

Sorry for my ignorance if it is not the same issue or permission problem.

affecting devices for example:

  • Galaxy Wide 4
  • Galaxy A31
  • Galaxy A32

log:

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
       at android.os.AsyncTask$4.done(AsyncTask.java:415)
       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
       at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
       at java.util.concurrent.FutureTask.run(FutureTask.java:271)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

Caused by java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{3d959b9 26912:MY_APP_ID/u0a338} (pid=26912, uid=10338) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2385)
       at android.os.Parcel.createException(Parcel.java:2369)
       at android.os.Parcel.readException(Parcel.java:2352)
       at android.os.Parcel.readException(Parcel.java:2294)
       at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:6680)
       at android.app.ActivityThread.acquireProvider(ActivityThread.java:7726)
       at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:3090)
       at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:2491)
       at android.content.ContentResolver.query(ContentResolver.java:1177)
       at android.content.ContentResolver.query(ContentResolver.java:1125)
       at android.content.ContentResolver.query(ContentResolver.java:1081)
       at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin.getCursor(ContactsServicePlugin.java:1)
       at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin$GetContactsTask.doInBackground(ContactsServicePlugin.java:1)
       at android.os.AsyncTask$3.call(AsyncTask.java:394)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)
0reactions
lukasgitcommented, May 12, 2021

Fixed in PR #208

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetching contacts in flutter - dart - Stack Overflow
I am trying to get contacts from device device using 'contacts_service' plugin. It is working fine on my device ...
Read more >
contacts_service | Flutter Package - Pub.dev
A Flutter plugin to retrieve and manage contacts on Android and iOS devices. ... Get all contacts on device List<Contact> contacts = await...
Read more >
연락처 허락 코드를 동작하면 꺼지는 현상 문의 - 코딩애플
ContactsServicePlugin.getCursor(ContactsServicePlugin.java:521) E/AndroidRuntime( 3688): at flutter.plugins.contactsservice.contactsservice.
Read more >
A Flutter plugin to retrieve and manage contacts on Android ...
ContactsServicePlugin.getCursor(ContactsServicePlugin.java:104) at flutter.plugins.contactsservice.contactsservice.
Read more >
flutter_contacts from lukasgit - GithubHelp
ContactsServicePlugin.getCursor(ContactsServicePlugin.java:205) E/AndroidRuntime(21167): at flutter.plugins.contactsservice.contactsservice.
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