URI formate exception
purna-jobget opened this issue · 11 comments
Faced the following issue while using the library in prod, any possible solution for
Fatal Exception: java.lang.IllegalArgumentException: uri format is unknown
at com.alexstyl.contactstore.RawContactQueries.fetchRawContacts(:2)
at com.alexstyl.contactstore.ContactQueries.access$fetchAdditionalColumns(:1)
at com.alexstyl.contactstore.ContactQueries$queryContacts$$inlined$map$1$2.emit(:69)
at com.alexstyl.contactstore.ContactQueries$queryAllContacts$$inlined$map$1$2.emit(:64)
at com.alexstyl.contactstore.utils.ContentResolverKt$runQueryFlow$$inlined$map$1$2.emit(:74)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
at com.alexstyl.contactstore.utils.FlowExtensionsKt$a.invokeSuspend(:34)
at com.alexstyl.contactstore.utils.FlowExtensionsKt$a.invoke(:1)
at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:116)
at com.alexstyl.contactstore.utils.ContentResolverKt$runQueryFlow$$inlined$map$1.collect(:21)
at com.alexstyl.contactstore.ContactQueries$queryAllContacts$$inlined$map$1.collect(:7)
at com.alexstyl.contactstore.ContactQueries$queryContacts$$inlined$map$1.collect(:11)
at kotlinx.coroutines.flow.FlowKt__ReduceKt.first(Reduce.kt:198)
at kotlinx.coroutines.flow.FlowKt.first(:1)
at com.alexstyl.contactstore.FetchRequest$a.invokeSuspend(:34)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:279)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(:1)
at com.alexstyl.contactstore.FetchRequest.blockingGet(:7)
at com.jobget.onboarding.requestendorsements.repo.DefaultUserContactsProvider.get$lambda-1(UserContactsProvider.kt:45)
at com.jobget.onboarding.requestendorsements.repo.DefaultUserContactsProvider.$r8$lambda$PCXMhjAq1fthczh8YCeZcJhq6FM()
at com.jobget.onboarding.requestendorsements.repo.DefaultUserContactsProvider$$ExternalSyntheticLambda4.call(:2)
at io.reactivex.rxjava3.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:46)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
at io.reactivex.rxjava3.internal.operators.observable.ObservableOnErrorReturn.subscribeActual(ObservableOnErrorReturn.java:31)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
at io.reactivex.rxjava3.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:644)
at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
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)
We just fetch the contacts in our application to show them to our users.
Hi @purna-jobget. Thanks for opening this issue.
I can see two parts here:
-
Make sure the app recovers if the uri is invalid (return null from
RawContactQueries.fetchRawContacts()
instead of throw). I am afraid I do not have much time to look and fix this myself, but the fix should be straightforward. You can open a PR yourself and I can merge your changes to the repo. -
Understand why the URI is invalid. The code in
RawContactQueries.fetchRawContacts()
is taken from AOSP. Maybe Android changed something and a new URI format was introduced. Do you mind sharing some information about the crash? Such as which Android versions it occurs and which phone models?
@alexstyl @purna-jobget this is a problem for us too. We're getting Crashlytics crashes about it. Unfortunately me trying to fix it would break everything. We're looking forward to it being fixed. Great work on the library btw!
@nwainwright can you share android versions and OEMs you are getting the crashes from?
@alexstyl Android 13 Galaxy S22 Ultra is one of our users that has crashed. Thank you!
@nwainwright other android versions and models would help. trying to understand if this is OEM specific, Android version specific or unrelated.
@alexstyl
Sorry, it's been a busy week last one. From the Crashlytics data, we have gathered so far. All the crashes happened on devices running OS >= 11. And No specific categorization on the manufacturer side. It happened on the stock as well as custom mods.
Significant Contributions by manufacturers:
44% Samsung
22% Wingtech
11% OnePlus
06% Motorola
By OS Version
50% on Android 11
44% on Android 12
06% on Android 13
@purna-jobget perfect. thanks for having a look.
@nwainwright could you kindly check as well?
That being aid, I will have a look this week (if not today) at the AOSP to see if something changed on Android 11+ which I was not aware about.
Just pushed a fix for this in b8a3294
Keeping this open until released.
EDIT: For those curious about why the URI might be invalid: I had a look at the AOSP. They are ignoring Uris they are not expecting. ContactStore will do the same to match that behavior. Those Uris are probably custom Raw Contact Uris created by apps, so probably not important for this part of the code base.