Custom View constructor in Android 4.4 crashes on Kotlin, how to fix? : <p>I have a custom view written in Kotlin using JvmOverloads that I could have default value.</p>

<pre><code>class MyView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyle: Int = 0,
    defStyleRes: Int = 0
) : LinearLayout(context, attrs, defStyle, defStyleRes)
</code></pre>

<p>All works fine in Android 5.1 and above.</p>

<p>However it crashes in 4.4, since the constructor in 4.4 doesn't have <code>defStyleRes</code>. How could I have that supported that in 5.1 and above I could have <code>defStyleRes</code> but not in 4.4, without need to explicitly having 4 constructors defined like we did in Java?</p>

<p>Note: The below would works fine in 4.4, but then we loose the <code>defStyleRes</code>.</p>

<pre><code>class MyView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyle: Int = 0
) : LinearLayout(context, attrs, defStyle)
</code></pre>
