yausername / youtubedl-android

youtube-dl for android
GNU General Public License v3.0
934 stars 172 forks source link

instance not initialized #249

Closed hung06031998 closed 8 months ago

hung06031998 commented 9 months ago

Everything works fine, but when I build .aab file and then distribute it to Firebase my app crashes.

My app uses single activity pattern In MainActivity: i init in onCreate lifecycleScope.launch(Dispatchers.IO) { try { YoutubeDL.getInstance().init(this@MainActivity) YoutubeDL.getInstance().updateYoutubeDL(this@MainActivity, YoutubeDL.UpdateChannel._NIGHTLY) } catch (e: Exception) { logD("YoutubeDL init fail: ${e.message}") } } then I get info video in viewModel viewModelScope.launch(Dispatchers.IO) { val request = YoutubeDLRequest(linkYT) request.addOption("-f", "best") val streamInfo = YoutubeDL.getInfo(request) localStorage.saveLinkVideoMod(streamInfo) }

log: FATAL EXCEPTION: DefaultDispatcher-worker-3 Process: com.bitu.user, PID: 17754 java.lang.IllegalStateException: instance not initialized at com.yausername.youtubedl_android.YoutubeDL.assertInit(YoutubeDL.kt:96) at com.yausername.youtubedl_android.YoutubeDL.execute(YoutubeDL.kt:146) at com.yausername.youtubedl_android.YoutubeDL.getInfo(YoutubeDL.kt:108) at com.bitu.android.common.viewmodels.VideoModViewModel$getInfoVideoMod$1.invokeSuspend(VideoModViewModel.kt:30) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@a2008e7, Dispatchers.IO]

palVikas9 commented 8 months ago

Hey, @hung06031998 ,

Can you guide me how this error was fixed at your end as I am facing a similar issue on my end ?