1. Create a new Android project. 2. Automatically convert the created Java Activity to Kotlin
``
package com.silverkeytech.NewsRivers
import android.app.Activity
import android.os.Bundle
public open class MainActivity(): Activity() {
public override fun onCreate(savedInstanceState: Bundle?): Unit {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
}
}
And deploy to an emulator
09-10 19:31:48.926: WARN/dalvikvm(2067): threadid=1: thread exiting with uncaught exception (group=0xb67f44f0) 09-10 19:31:48.926: ERROR/AndroidRuntime(2067): FATAL EXCEPTION: main java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.silverkeytech.NewsRivers/com.silverkeytech.NewsRivers.MainActivity}: java.lang.ClassNotFoundException: com.silverkeytech.NewsRivers.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.silverkeytech.NewsRivers-2.apk] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3683) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.silverkeytech.NewsRivers.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.silverkeytech.NewsRivers-2.apk] at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) at java.lang.ClassLoader.loadClass(ClassLoader.java:551) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at android.app.Instrumentation.newActivity(Instrumentation.java:1021) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)