Hi,
I’m running into some trouble trying to use Android Studio to develop a Kotlin-based simple Android application. It appears that I cannot get the IDE plugin and the gradle plugin to agree on the type signatures of the various Android SDK methods that I am overriding.
I’m running:
Android Studio Preview 0.4.0 with embedded Android SDK
OS X 10.9.1
Java 1.6.0_65
Kotlin IDE plugin 0.6.1683
kotlin-gradle-plugin 0.6.1673
kotlin-stdlib 0.6.1673
Android compile SDK version 19
Build Tools 19.0.0
I was following the guide from the Kotlin blog[1], which recommends that the version of the stdlib and gradle-plugin should match the IDE plugin. However, there is no 0.6.1683 version in Maven Central for either of these. I tried version 0.6.1910, which is the newest, but this also resulted in the same problem.
The issue is, the IDE is flagging various overrides in my test activity and fragment with errors, but the gradle plugin is building OK. If I change the signatures to make the IDE happy, the gradle plugin fails to build.
A specific example is the override for:
android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
The IDE wants every parameter type to be nullable, however, the gradle plugin wants the first parameter to be non-nullable.
I have tried configuring the gradle plugin to use the same external annotations jar the IDE plugin is using, but it seems that I can only specify additional external annotation jars and not actually replace the default one, as the errors remain. I have also tried configuring the Android SDK inside the IDE to use the same external annotation jar the gradle plugin is using, but this seems to have no effect (other than the IDE complaining that external annotations are not configured).
Does anyone have any suggestions? It seems I can work around the issues in a one-off fashion by specifying custom Kotlin signatures in my project for the problematic methods, but I’d love to find a more general solution.
If I can provide any more information, please let me know. Thanks in advance!
[1] http://blog.jetbrains.com/kotlin/2013/08/working-with-kotlin-in-android-studio/