Skip to content
Advertisement

How to build cordova project with Kotlin

I have a cordova project folder www already in progress.

Build this and you will have an Android project.

This will create a MainActivity.java file.

I don’t know Java so I changed the file to MainActivity.kt and converted the internal code.

But when I run it, it doesn’t run as error.

Build cordova:

JavaScript

Created MainActivity.java:

JavaScript

converted MainActivity.kt:

JavaScript

Get error….:

2020-03-09 18:56:57.159 7625-7625/com.example.gamename E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.gamename, PID: 7625 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gamename/com.example.gamename.MainActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter savedInstanceState

Is there a solution? Or is there no way?

It must be resolved to use authentication, payment, and db (unfortunately I don’t know Java).

Advertisement

Answer

Need to change Bundle into “Bundle?” in MainActivity.kt.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement