0

In my Android Studio 2.3.3 I have installed Kotlin plugin and then created a kotlin class activity. When I comple and run for that Activity I am getting ClassNotFoundException. I confirm that I have added the new Activity in the manifest file for sure.

I am trying Kotlin with Android for the first time and not sure if anything need to change in gradle file or not for using Kotlin.

Below is my error log:

FATAL EXCEPTION: main
Process: com.example.chandan.myapplication, PID: 16035
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.chandan.myapplication/com.example.chandan.myapplication.RegistrationActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.chandan.myapplication.RegistrationActivity" on path: DexPathList[[zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/base.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/lib/x86, /system/lib, /system/vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2718)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.chandan.myapplication.RegistrationActivity" on path: DexPathList[[zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/base.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.chandan.myapplication-xkv2k_8ODBWxxa3Gsn-HDw==/lib/x86, /system/lib, /system/vendor/lib]]

1 Answer 1

1

You also need to add the kotlin plugin to the root project build.gradle and app-module build.gradle.

Follow below url for detailed info:-

http://www.limbaniandroid.com/2017/06/setup-kotlin-plugin-for-android-studio.html

Sign up to request clarification or add additional context in comments.

1 Comment

yes. That build.gradle things were missing. Thanks a lot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.