Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug : Sending a message #41

Open
yongsuk44 opened this issue Mar 21, 2024 · 3 comments
Open

Bug : Sending a message #41

yongsuk44 opened this issue Mar 21, 2024 · 3 comments

Comments

@yongsuk44
Copy link

  • Issue
    Sending a message and navigating to the chat list crashes and closes the app
Screen_Recording_20240321-101635_SociaLite.mp4
  • StackTrace
com...gle.android.samples.socialite  E  FATAL EXCEPTION: pool-2-thread-1
    Process: com.google.android.samples.socialite, PID: 2421
    java.lang.IllegalArgumentException: Context is required to resolve the file uri of the icon: content://com.google.android.samples.socialite/icon/1
        at androidx.core.graphics.drawable.IconCompat$Api23Impl.toIcon(IconCompat.java:1297)
        at androidx.core.graphics.drawable.IconCompat.toIcon(IconCompat.java:529)
        at androidx.core.graphics.drawable.IconCompat.toIcon(IconCompat.java:517)
        at androidx.core.app.Person$Api28Impl.toAndroidPerson(Person.java:427)
        at androidx.core.app.Person.toAndroidPerson(Person.java:152)
        at androidx.core.app.NotificationCompatBuilder.<init>(NotificationCompatBuilder.java:263)
        at androidx.core.app.NotificationCompat$Builder.build(NotificationCompat.java:2531)
        at com.google.android.samples.socialite.repository.NotificationHelper.showNotification(NotificationHelper.kt:274)
        at com.google.android.samples.socialite.repository.NotificationHelper.showNotification$default(NotificationHelper.kt:159)
        at com.google.android.samples.socialite.repository.ChatRepository$sendMessage$2.invokeSuspend(ChatRepository.kt:92)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
        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:919)
        Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@285c18d, java.util.concurrent.Executors$FinalizableDelegatedExecutorService@3fa8f42]
@Goooler
Copy link
Contributor

Goooler commented Apr 25, 2024

This happens on Android 8 devices, it's related to

https://github.com/androidx/androidx/blob/8f1a8f894c9d806014eafc4c9a3b5cd6b808ba68/core/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java#L252-L256

https://github.com/androidx/androidx/blob/8f1a8f894c9d806014eafc4c9a3b5cd6b808ba68/core/core/src/main/java/androidx/core/app/Person.java#L427

It should call androidx.core.graphics.drawable.IconCompat#toIcon(android.content.Context) here.

@Goooler
Copy link
Contributor

Goooler commented Apr 25, 2024

You can try out #64.

@Goooler
Copy link
Contributor

Goooler commented Apr 25, 2024

One more related issue on Android 10:

java.lang.IllegalArgumentException: Context is required to resolve the file uri of the icon: content://com.google.android.samples.socialite/icon/3
  at androidx.core.graphics.drawable.IconCompat$Api23Impl.toIcon(IconCompat.java:1297)
  at androidx.core.graphics.drawable.IconCompat.toIcon(IconCompat.java:529)
  at androidx.core.graphics.drawable.IconCompat.toIcon(IconCompat.java:517)
  at androidx.core.app.NotificationCompat$BubbleMetadata$Api29Impl.toPlatform(NotificationCompat.java:8788)
  at androidx.core.app.NotificationCompat$BubbleMetadata.toPlatform(NotificationCompat.java:8501)
  at androidx.core.app.NotificationCompatBuilder.<init>(NotificationCompatBuilder.java:262)
  at androidx.core.app.NotificationCompat$Builder.build(NotificationCompat.java:2524)
  at com.google.android.samples.socialite.repository.NotificationHelper.showNotification(NotificationHelper.kt:274)
  at com.google.android.samples.socialite.repository.NotificationHelper.showNotification$default(NotificationHelper.kt:159)
  at com.google.android.samples.socialite.repository.ChatRepository$sendMessage$2.invokeSuspend(ChatRepository.kt:95)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
  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:919)

Due to

https://github.com/androidx/androidx/blob/710392834c2317072387b04235d2ad02012abaf8/core/core/src/main/java/androidx/core/app/NotificationCompat.java#L8788

https://github.com/androidx/androidx/blob/710392834c2317072387b04235d2ad02012abaf8/core/core/src/main/java/androidx/core/app/NotificationCompat.java#L8872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants