简体   繁体   中英

Eclipse + Kotlin + Gradle issues: Unresolved reference: println

I am trying to get Eclipse + Kotlin + Gradle combo working, but having a number of issues:

When combined with Kotlin and Gradle plug-ins Eclipse starts marking valid Kotlin code as erroneous:

1  fun main() {
2       val a = 42
3       val b = -42
4       var c = 123
5       val d = a + b + c
6       println("Kotlin Gradle Test: The 'a' value is $a, 'b' value is $b and 'c' value is $c.")
7  }

The above code results in Eclipse in one warning and one error:

line 6: Warning: Variable 'd' is never used (correct)
line 7: Eror: Unresolved reference: println (incorrect, println is a valid function in Kotlin)`

Any ideas why it's happening and how to resolve it? I ran the above code as a part of the Kotlin project (without Gradle) and Eclipse did not show any errors related to println. Running "gradlew build" from the command line also does not produce any println errors.

Thanks

The eclipse configuration is missing either the Kotlin nature or the Kotlin standard library or both. Refer to this question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM