Kotlin Early Access Preview (Updated!)

Update: another version in the preview: 1.0.0-rc-1025

We’re happy to announce the beginning of the public Early Access Preview program for Kotlin. The program gives you a chance to try out new versions of Kotlin before they are officially released to the public, and to give your feedback.

Right now the Early Access Preview builds for Kotlin 1.0 Release Candidate are available.

To use the new builds from Maven or Gradle: add https://dl.bintray.com/kotlin/kotlin-eap/ as a repository to your project. The EAP build version is ​1.0.0-rc-1017

To install the EAP version of the IntelliJ IDEA plugin: open Tools | Kotlin | Configure Kotlin Plugin Updates in the main menu, select the Early Access Preview channel, press the Check for updates now button

New features and changes (draft): Kotlin 1.0.0-RC: What's new.md · GitHub

If you’re a library maintainer, ​please don’t publish updates of your library​ compiled with the EAP build to your main Maven repository. This is necessary to ensure that users don’t run into unexpected compatbility issues.(edited)

As usual, please report issues to YouTrack: http://youtrack.jetbrains.com/issues/KT

6 Likes

Just out of interest, why shouldn’t we publish updates of our libraries with the EAP build but should instead publish them with the beta builds?

1 Like

What about incremental compilation in gradle plugin?

Because these require recompilation of clients with an RC build, and the RC build is not published in Maven Central yet.

Incremental compilation in Gradle is on its way. It will be have experimental status anyways, but we hope to include it into public builds ASAP (won’t delay 1.0 if it needs more time though).

Update: another version in the preview: 1.0.0-rc-1025

1 Like

I tried moving my Android apps over to the latest preview version, which seems to be 1.0.0-rc-1036 (installed manually, per the advice given). After making all the necessary changes to my Gradle configs and fixing a few minor things, I got a clean compile. That’s good. But then I tried running ProGuard and got a stack of errors, quoted below. My question is what I need to do to get this working properly. (You can see the full configuration at my Github project.) The relevant lines in my Gradle file:

buildTypes {
    release {
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        minifyEnabled true
        shrinkResources true
    }
}

And there’s nothing fancy in my proguard-rules file. It just “keeps” a bunch of my own public classes – the ones that are entry points from the XML manifest – and it explicitly says -dontobfuscate, which has historically been the compromise that lets me ignore the mountain of unnecessary warnings while still getting the binary shrinkage that I want.

EDIT: It’s actually worse than I thought. With the debug build, so no ProGuard at all, when I try to run this Android yells at me, saying java.lang.ClassNotFoundException: Didn't find class "org.dwallach.xstopwatch.StopwatchActivity". That’s not good. I suspect a fix for this problem would also fix my ProGuard problems. Thoughts anyone?

EDIT 2: The fix for the ClassNotFoundException was to hack the top of my Gradle file to say:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

I misread the docs and thought that line 2 was obsoleted by line 3 above. Nope. You still need line 2. Anyway, the same ProGuard errors still occur, but I have a fully running app when I disable ProGuard.

EDIT 3: The workaround seems to be adding -dontwarn kotlin.** to the Proguard file.

ProGuard, version 5.2.1
Reading input…
Reading program jar [/Users/dwallach/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.0.0-rc-1036/d676f54e166597168eb979d566b2362aed0aef4b/kotlin-stdlib-1.0.0-rc-1036.jar] (filtered)
Reading program jar [/usr/local/android-sdk-macosx/extras/android/m2repository/com/android/support/support-annotations/23.1.1/support-annotations-23.1.1.jar] (filtered)
Reading program jar [/Users/dwallach/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/1.0.0-rc-1036/5d0e176a4c83cd1fa25c321f42802d2460753071/kotlin-runtime-1.0.0-rc-1036.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/8.4.0/jars/classes.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/8.4.0/jars/classes.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/8.4.0/jars/classes.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/exploded-aar/com.google.android.support/wearable/1.3.0/jars/classes.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.0.0/jars/classes.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars/classes.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars/libs/internal_impl-23.1.1.jar] (filtered)
Reading program jar [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/transforms/mergeJavaRes/release/jars/2/1f/main.jar] (filtered)
Reading program directory [/Users/dwallach/AndroidStudioProjects/XStopwatch/wear/build/intermediates/classes/release] (filtered)
Reading library jar [/usr/local/android-sdk-macosx/platforms/android-23/android.jar]
Reading library jar [/usr/local/android-sdk-macosx/platforms/android-23/optional/org.apache.http.legacy.jar]
Note: duplicate definition of library class [android.net.http.SslError]
Note: duplicate definition of library class [android.net.http.SslCertificate]
Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver]
Note: duplicate definition of library class [org.apache.http.conn.scheme.SocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.ConnectTimeoutException]
Note: duplicate definition of library class [org.apache.http.params.HttpParams]
Note: there were 7 duplicate class definitions.
(ProGuard Manual: Troubleshooting | Guardsquare)
Initializing…
Note: the configuration refers to the unknown class ‘android.support.v7.widget.TestActivity’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.NotificationService’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.Receiver’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.StopwatchActivity’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.StopwatchText’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.TimerActivity’
Note: the configuration refers to the unknown class ‘com.google.vending.licensing.ILicensingService’
Note: the configuration refers to the unknown class ‘com.android.vending.licensing.ILicensingService’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.XWatchfaceReceiver’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.Receiver’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.StopwatchActivity’
Note: the configuration refers to the unknown class ‘org.dwallach.xstopwatch.TimerActivity’
Note: android.support.v4.app.NotificationCompatJellybean calls ‘Field.getType’
Note: com.google.android.gms.internal.zzsv calls ‘Field.getType’
Note: kotlin.jvm.internal.Lambda calls ‘Class.getGenericInterfaces’
Warning:kotlin.ExceptionsKt: can’t find referenced method ‘void printStackTrace(java.lang.Throwable)’ in program class kotlin.ExceptionsKt__ExceptionsKt
Warning:kotlin.ExceptionsKt: can’t find referenced method ‘void printStackTrace(java.lang.Throwable,java.io.PrintStream)’ in program class kotlin.ExceptionsKt__ExceptionsKt
Warning:kotlin.ExceptionsKt: can’t find referenced method ‘void printStackTrace(java.lang.Throwable,java.io.PrintWriter)’ in program class kotlin.ExceptionsKt__ExceptionsKt
Warning:kotlin.MathKt: can’t find referenced method ‘java.math.BigDecimal div(java.math.BigDecimal,java.math.BigDecimal)’ in program class kotlin.MathKt__BigNumbersKt
Warning:kotlin.MathKt: can’t find referenced method ‘java.math.BigInteger div(java.math.BigInteger,java.math.BigInteger)’ in program class kotlin.MathKt__BigNumbersKt
Warning:kotlin.MathKt: can’t find referenced method ‘boolean isFinite(double)’ in program class kotlin.MathKt__NumbersKt
Warning:kotlin.MathKt: can’t find referenced method ‘boolean isFinite(float)’ in program class kotlin.MathKt__NumbersKt
Warning:kotlin.MathKt: can’t find referenced method ‘boolean isInfinite(double)’ in program class kotlin.MathKt__NumbersKt
Warning:kotlin.MathKt: can’t find referenced method ‘boolean isInfinite(float)’ in program class kotlin.MathKt__NumbersKt
Warning:kotlin.MathKt: can’t find referenced method ‘boolean isNaN(double)’ in program class kotlin.MathKt__NumbersKt
Warning:kotlin.MathKt: can’t find referenced method ‘boolean isNaN(float)’ in program class kotlin.MathKt__NumbersKt

— long list of other warnings deleted —

Fixed: https://youtrack.jetbrains.com/issue/KT-10858

1 Like