hey guys i'm trying to play sound with korau and g...
# korge
d
hey guys i'm trying to play sound with korau and getting this error on android (desktop and web are fine) `java.lang.IllegalStateException: Android context not set! Please call
withAndroidContext()
method in your coroutine body` what does it mean and how can i make my sound layer as generic as possible?
👍🏼 1
r
TL;DR, I can't actually answer your question, as it's my very first day in KorGE (I'm an Android dev though). If you find something please share. Context is a class in Android that holds various info related to the app and the devices like the screen size, resource references, etc. The
applicationContext
is created when the app starts and then in general it just being passed down to other classes. I'd guess that
withAndroidContext()
initializes a local variable with
applicationContext
, which will allow your code to access the resource you are looking for. From what I found online, it seems to be a bug with newer versions of korio. In any case, you can use
Platform.os.isAndroid
to differentiate the code being execuded in Android from the rest of platforms.
164 Views