Unresolved reference: js for kotlin-js-hello


Hi,   Could you, please, hint where I have problem? I tried compile JS example (kotlin-js-hello), but still getting errors with "unresolved reference: js". Trying own project has same result with error report about "native" even if I add "import js.native". With Kotlin -> JVM isn't problem.

I using IC-123.23 (also in 123.4) with kotlin 0.4.231 under jdk7-openjdk 7.u9_2.3.3-1 (Archlinux, Linux lupy 3.6.7-1-ARCH #1 SMP PREEMPT Sun Nov 18 10:11:22 CET 2012 x86_64 GNU/Linux)

package android

import js.*
import js.native

public public class Bundle(){

open public class Activity() {
  protected open fun onCreate(savedInstanceState: Bundle?): Unit  = js.noImpl
  protected fun onStart() : Nothing = js.noImpl
  protected fun onRestart() : Nothing = js.noImpl
  protected fun onResume() : Nothing = js.noImpl
  protected fun onPause() : Nothing = js.noImpl
  protected fun onStop() : Nothing = js.noImpl
  protected fun onDestroy() : Nothing = js.noImpl

fun setContentView(num: Int): Nothing = js.noImpl


untitled6.zip (34.5 KB)


"Use external build" option in IDEA is unsupported for js-kotlin-project right now. As workaround go to Settings/Compiler and uncheck the "Use external build" checkbox.


Additionally, you had old runtime library -- fixed in attachment. And super is not supported in current JS-backend -- temporarily, I comment out this line.

If the Activity will be stateless you can make it trait and write next workaround:

public class MyActivity(val jsSuper: Activity = object: Activity{} ) : Activity by jsSuper {   public override fun onCreate(savedInstanceState : Bundle?) : Unit {   jsSuper.onCreate(savedInstanceState)   setContentView(0)   } }

untitled6_fixed.zip (33.4 KB)