Skip to content Skip to sidebar Skip to footer

I Have Error In Android Studio With Kotlin

why this error? 09-12 16:36:31.502 1886-1886/com.getloction.nourmedhat.smartgate.getlocation E/AndroidRuntime: FATAL EXCEPTION: main Process: com.getloction.nourmedhat

Solution 1:

As commented by AlexTa you're getting a TypeCastException because you cast null to a non-null type.

In Kotlin types are "@NotNull" by default. So if you declare a variable like this:

varyourVar: String

you cannot assign null to it. If it should be capable of storing null (which it often shouldn't) you declare it like this:

varyourVar: String? = null

Post a Comment for "I Have Error In Android Studio With Kotlin"