我当时使用通讯录服务扑朔迷离的软件包,直到现在它仍然运行良好。但是在将flutter更新到新版本后,它会使应用程序崩溃。
dependencies:
contacts_service: ^0.3.2
给出以下错误:
E/AndroidRuntime(19843): java.lang.RuntimeException: An error occurred while executing doInBackground()
E/AndroidRuntime(19843): at android.os.AsyncTask$3.done(AsyncTask.java:354)
E/AndroidRuntime(19843): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
E/AndroidRuntime(19843): at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
E/AndroidRuntime(19843): at java.util.concurrent.FutureTask.run(FutureTask.java:271)
E/AndroidRuntime(19843): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
E/AndroidRuntime(19843): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(19843): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(19843): at java.lang.Thread.run(Thread.java:764)
E/AndroidRuntime(19843): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference
E/AndroidRuntime(19843): at flutter.plugins.contactsservice.contactsservice.Contact.compareTo(Contact.java:94)
E/AndroidRuntime(19843): at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin$GetContactsTask$1.compare(ContactsServicePlugin.java:175)
E/AndroidRuntime(19843): at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin$GetContactsTask$1.compare(ContactsServicePlugin.java:172)
E/AndroidRuntime(19843): at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
E/AndroidRuntime(19843): at java.util.TimSort.sort(TimSort.java:234)
E/AndroidRuntime(19843): at java.util.Arrays.sort(Arrays.java:1498)
E/AndroidRuntime(19843): at java.util.ArrayList.sort(ArrayList.java:1470)
E/AndroidRuntime(19843): at java.util.Collections.sort(Collections.java:201)
E/AndroidRuntime(19843): at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin$GetContactsTask.doInBackground(ContactsServicePlugin.java:178)
E/AndroidRuntime(19843): at flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin$GetContactsTask.doInBackground(ContactsServicePlugin.java:137)
E/AndroidRuntime(19843): at android.os.AsyncTask$2.call(AsyncTask.java:333)
E/AndroidRuntime(19843): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/AndroidRuntime(19843): ... 4 more
首先,我要求获得联系人许可以及所有许可,然后执行获取操作:
phoneContacts = await ContactsService.getContacts();
我不知道lowerCase的去向,我删除了项目中的所有.toLowerCase,但错误没有改变。 我该怎么办?