Hey guys is this an appropriate place to ask about...
# android
j
Hey guys is this an appropriate place to ask about potential issues with Kotlin on Android? 🤔 - I have a really bizzar issue that might be being caused by me but anyways… I’ve created a simple event dispatcher that’s lazy initialised like so
Copy code
companion object {
        val instance by lazy { EventDispatcher() }
    }
and whenever I add anything to it and try to dispatch an event, I receive the following error
java.lang.NoClassDefFoundError: jonnothebonno.me.app.notifications.events.EventDispatcher$dispatchEvent$1
The weird thing is, this only appears to happen on older mobiles. Works perfect on my pixel but crashes on my nexus 5. I’m using
Kotlin 1.1.1
and
gradle 2.3.0
l
Does this happens on debug builds only?
j
Hey Louis. No it happens on both debug and release builds. 😰
l
@jonnothebonno Can you show me the code of
EventDispatcher
? Consider private message if it can't be public
j
Yeah sure, one moment.
l
@jonnothebonno Haha, simple. Just add parenthesis around the lambda parameters
You're calling some java 8 code. Adding parenthesis means destructuration, and this is from kotlin's stdlib, not java 8
j
omg really? thank you 🤣 stupid me
l
@jonnothebonno Let me know if it worked fine
j
Will try it now!
it worked! thank you so much 😄
😉 1