android / tv-samples

Multiple samples showing best practices in app development on Android TV.
Apache License 2.0
1.05k stars 332 forks source link

Runtime exception: Unable to publish channel #42

Open imrankst1221 opened 3 years ago

imrankst1221 commented 3 years ago

I was trying to run the project at Android Studio 4.1.1 but it's got a runtime exception.

2020-11-25 06:51:44.422 30804-30854/com.android.tv.classics E/TvLauncherUtils: Unable to publish channel java.io.IOException: Failed to add logo, so channel (ID=51) was not created at androidx.tvprovider.media.tv.PreviewChannelHelper.publishChannel(PreviewChannelHelper.java:136) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel(TvLauncherUtils.kt:222) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel$default(TvLauncherUtils.kt:157) at com.android.tv.classics.workers.TvMediaSynchronizer$Companion.synchronize(TvMediaSynchronizer.kt:165) at com.android.tv.classics.fragments.MediaBrowserFragment$onCreate$4.invokeSuspend(MediaBrowserFragment.kt:158) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740) 2020-11-25 06:51:44.448 30804-30854/com.android.tv.classics E/PreviewChannel: Logo for preview channel (ID:12) not found. java.io.FileNotFoundException: content://android.media.tv/channel/12/logo at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:149) at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705) at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1687) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1503) at android.content.ContentResolver.openInputStream(ContentResolver.java:1187) at androidx.tvprovider.media.tv.PreviewChannel.getLogo(PreviewChannel.java:175) at androidx.tvprovider.media.tv.PreviewChannelHelper.addChannelLogo(PreviewChannelHelper.java:268) at androidx.tvprovider.media.tv.PreviewChannelHelper.updatePreviewChannel(PreviewChannelHelper.java:234) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel(TvLauncherUtils.kt:212) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel$default(TvLauncherUtils.kt:157) at com.android.tv.classics.workers.TvMediaSynchronizer$Companion.synchronize(TvMediaSynchronizer.kt:165) at com.android.tv.classics.fragments.MediaBrowserFragment$onCreate$4.invokeSuspend(MediaBrowserFragment.kt:158)

superbderrick commented 3 years ago

333 | 12-07 | 20:50:38.375 | I | 1624 | 1624 | Choreographer: |   | Skipped 47 frames!  The application may be doing too much work on its main thread.
-- | -- | -- | -- | -- | -- | -- | -- | --
334 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | Logo for preview channel (ID:-1) not found.
335 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | java.io.FileNotFoundException: content://android.media.tv/channel/-1/logo
336 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:149)
337 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705)
338 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1687)
339 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1503)
340 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at android.content.ContentResolver.openInputStream(ContentResolver.java:1187)
341 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at androidx.tvprovider.media.tv.PreviewChannel.getLogo(PreviewChannel.java:175)
342 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at androidx.tvprovider.media.tv.PreviewChannelHelper.addChannelLogo(PreviewChannelHelper.java:268)
343 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at androidx.tvprovider.media.tv.PreviewChannelHelper.publishChannel(PreviewChannelHelper.java:132)
344 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel(TvLauncherUtils.kt:222)
345 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel$default(TvLauncherUtils.kt:157)
346 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at com.android.tv.classics.workers.TvMediaSynchronizer$Companion.synchronize(TvMediaSynchronizer.kt:165)
347 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at com.android.tv.classics.fragments.MediaBrowserFragment$onCreate$4.invokeSuspend(MediaBrowserFragment.kt:158)
348 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
349 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
350 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
351 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
352 | 12-07 | 20:50:38.386 | E | 1624 | 1711 | PreviewChannel: |   | at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)
353 | 12-07 | 20:50:38.404 | D | 1624 | 1624 | MediaBrowserFragment: |   | Requesting scrolling to 0

I was able to reproduce same with android emulator, Do we have to set some logo? in order to claasy sample?

IanGClifton commented 3 years ago

Can you verify that the device both has an internet connection and is set to the correct time? That error looks like the device failed to fetch the channel logo.

aiden-kkni commented 3 years ago

I have the same issue
E/PreviewChannel: Logo for preview channel (ID:-1) not found. java.io.FileNotFoundException: content://android.media.tv/channel/-1/logo

Lizzergas commented 2 years ago

This is still happening in the official Google Codelab.

To reproduce, clone tv-recommendations-kotlin sample, run step_final and observe the logcat. My blind guess would be that PreviewChannel.Builder() fails to fetch given URI image

iepsen commented 2 years ago

Hey folks!

I went into the same issue today, and as @IanGClifton suggested, I had a look at the operating system's date and time. For some reason, the emulator can't set the date and time properly when "Automatic date and time" is "On".

@TheScriptan have you checked your device's date and time?

iepsen commented 2 years ago

@bhrashmi14 I can try to repro. Can you give me more details about your setup?