Unable do use kotlin with android gradle plugin version higher than 0.14.2


#1

Hello, we have been successfully using Kotlin in AndroidStudio + gradle setup to develop kotlin app with java interop, no major problems there.

With the upgrade of android gradle pluginto 0.14.4 we encountered a problem.

After changing 0.14.2 to 0.14.4 we sync the project (with success) and then we’re asked about restarting AS due to language level changes. After clicking ok the project reloads successfully, but all builds now on fail with this stacktrace: (attached)

We are using (0.9.855).5976 of kotlin plugin downloaded from CI. I believe that the problem was present in one of previous builds too.

I think it might be related to this: (output when using 0.14.2)
WARNING [Project: :app] variant.getProcessResources() is deprecated. Call it on one of variant.getOutputs() instead.



stacktrace.txt.zip (1.75 KB)

#2

Try updating to the recently published 0.9.976, if it does not fix your problem, please let us know. Thanks!


#3

Here's the build page for the IDE plugin: https://teamcity.jetbrains.com/viewLog.html?buildId=194210&tab=artifacts&buildTypeId=bt345&guest=true


#4

Android Studio is based on older InteliJ version, namely 135.x. unfortunately I wasn't able to use exact artifact you pointed. idea13 banch is outdated, so I couldnt test it at this time. I'll report as soon as it'll get updated.

Thanks for quick response :slight_smile:


#5

I think this build may work for you: https://teamcity.jetbrains.com/viewLog.html?buildId=194282&buildTypeId=bt345&tab=artifacts Actually, I think there might be no need to update the IDE plugin at all.


#6

Yeah, I did give this build a try it before my last reply, thought this one would work, however it didint. It installs fine, however the build still fails on the same step, same stack.

Caused by: java.lang.NoSuchMethodError: com.android.build.gradle.api.BaseVariant.getProcessResources()Lcom/android/build/gradle/tasks/ProcessAndroidResources;
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin$processVariants$1.call(KotlinPlugin.kt:231)


#7

I see. We'll investigate more. Thanks a lot for the report.


#8

I suspect I might be doing something wrong somewhere... I dug deeper, and noticed one thing.

We installed the updated plugin into the IDE. We didnt change the build.gradle file itself, also we still use android-gradle and stdlib verions 0.9.206.  This might be the reason.


#9

Ok, after adding snapshots maven and changing to use 0.1-SNAPSHOT version of kotlin gradle plugin I've managed to run a successful build. I hope that main maven repo gets updated soon, because using snapshots in production app doesnt seem to be anywhere near safe.

Thanks for the help :slight_smile:


#10

Then Kotlin Gradle plugin version 0.9.976 should work for you