I have an existing Android Project that uses the following libs:
I am trying to add Kotlin Support so that I can slowly migrate the project over to Kotlin. Here is what I have done.
Converted one of the classes over to Kt class and moved over to src/main/kotlin/..package..
Added kotlin in source set. sourceSets { main.java.srcDirs += 'src/main/kotlin' }
When I do a clean build and deploy the app, I get NoClassDefFoundError exception. However, If I deploy again it works just fine.
Any suggestions? I do not have any annotation in the class I converted so I did not apply kapt
plugin.
Note: I am using latest kotlin 1.0.4. Also I have instant run disabled.
Go to Files > Settings
and turn off completely Instant Run
, I mean all checkboxes should be unchecked.
Clean and rebuild project.
Then it should work
Edit: As you said that Instant is disabled - using protip
check your configuration and update Gradle and Android Studio if you're not using the latest.
According to this issue, changing Gradle plugin version from 2.10 to 2.14.1 may help.
Protip: Use combination Ctrl+Shift+A to find commands like
Configure Kotlin in Project
Configure Kotlin Updates
Convert Java File to Kotlin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With