The new kapt2 that implements JSR 269 for Kotlin (this should improve compatibility with existing annotation processors). This feature is considered experimental. To try it just add
apply plugin: 'kotlin-kapt'
to your gradle.build files and remove
kapt {
generateStubs = true
}
Incremental compilation for Gradle now can track changes between the subprojects. This should improve build times (if IC is enabled) for multi-project builds.
It’s possible to evaluate Kotlin expressions when debugging Java files.
I get error for kotlin-annotation-processing, after I have added the repo and changed the version variable. It is not searching the new repo, for this one?
What went wrong:
A problem occurred evaluating project ‘:app’.
Could not find method kapt2() for arguments [com.google.dagger:dagger-compiler:2.6] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Kotlin-kapt plugin is there. It’s android gradle ver 2.2. Thanks.
update Okay, I realized ‘kapt’ should be used instead of ‘kapt2’. No problem, works as expected!
java.lang.NoClassDefFoundError: org/jetbrains/kotlin/asJava/KtLightElement
at cn.nekocode.plugin.parcelablegenerator.utils.KtClassHelper.getKtClassForElement(KtClassHelper.java:62)
at cn.nekocode.plugin.parcelablegenerator.ParcelableAction.getPsiClassFromEvent(ParcelableAction.java:89)
at cn.nekocode.plugin.parcelablegenerator.ParcelableAction.update(ParcelableAction.java:69)
at com.intellij.openapi.actionSystem.AnAction.beforeActionPerformedUpdate(AnAction.java:246)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:117)
at com.intellij.ui.popup.PopupFactoryImpl$ActionStepBuilder.appendAction(PopupFactoryImpl.java:1045)
at com.intellij.ui.popup.PopupFactoryImpl$ActionStepBuilder.appendActionsFromGroup(PopupFactoryImpl.java:1035)
at com.intellij.ui.popup.PopupFactoryImpl$ActionStepBuilder.buildGroup(PopupFactoryImpl.java:971)
at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.createStep(PopupFactoryImpl.java:280)
at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.(PopupFactoryImpl.java:223)
at com.intellij.ui.popup.PopupFactoryImpl.createActionGroupPopup(PopupFactoryImpl.java:202)
at com.intellij.ui.popup.PopupFactoryImpl.createActionGroupPopup(PopupFactoryImpl.java:176)
at com.intellij.ui.popup.PopupFactoryImpl.createActionGroupPopup(PopupFactoryImpl.java:372)
at com.intellij.codeInsight.generation.actions.GenerateAction.actionPerformed(GenerateAction.java:38)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:595)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:646)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:485)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:215)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:631)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Sure, I have checked, 1.0.4-eap-118 is the very first version that I have tried. May be this is another error.
What defined:
ext.kotlin_version = ‘1.0.4-eap-118’
Error trace:
e: java.lang.AssertionError: Rewrite at slice LEAKING_THIS key: REFERENCE_EXPRESSION old value: PropertyIsNull(property=private final val m: Matrix defined in ru.xxxx.xxx.fragments.analytics.SwitchAvatarButton[PropertyDescriptorImpl@195ae9ce], classOrObject=CLASS)@1425541271 new value: PropertyIsNull(property=private final val staticAvatarPosition: Point defined in ru.xxxx.xxx.fragments.analytics.SwitchAvatarButton[PropertyDescriptorImpl@77bea658], classOrObject=CLASS)@2130275126
File name: SwitchAvatarButton.kt Physical: true
java.lang.Throwable
at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.Logger.error(Logger.java:127)
at org.jetbrains.kotlin.util.slicedMap.Slices$1.processRewrite(Slices.java:40)
at org.jetbrains.kotlin.util.slicedMap.SlicedMapImpl.put(SlicedMapImpl.java:60)
So, generally it looks like
class SwitchAvatarButton : View {
…
private lateinit var movingAvatar: Bitmap
private lateinit var staticAvatar: Bitmap
private val staticAvatarPosition = Point()
private val movingAvatarPosition = Point()
private val srcRect = RectF()
private val dstRect = RectF()
private val m = Matrix()
private var positionAnimator: PositionAnimation? = null
...