Skip to content
Advertisement

LibGDX GWT/HTML with Kotlin: “No source code is available for type , did you forget to inherit a required module?”

I generated a simple libGDX project with no dependencies. When I tried to build it as HTML app with Gradle (./gradlew html:dist), I get the following error message:

Tracing compile failure path for type 'xjcl.downgradius.client.HtmlLauncher'
   [ERROR] Errors in 'file:/home/jan/Dropbox/py/AndroidStudioProjects/Downgradius_Android/html/src/xjcl/downgradius/client/HtmlLauncher.java'
      [ERROR] Line 49: No source code is available for type xjcl.downgradius.DowngradiusGame; did you forget to inherit a required module?

I think the problem is caused by me using Kotlin in this project, and libGDX being intended for Java development. I observed that when I made a new main Game class in Java, that class was found by GWT, but not the Kotlin classes it imports.

I know Kotlin does some re-packaging (for example, if you put funA and funB in file Foo, they will be re-packaged as part of a new FooKt package, I think), but it should be able to find it as

  • it is declared in the right package (xjcl.downgradius)
  • it is declared as the only class in its file
  • I get no IDE warnings about importing it from Java.

I also tried converting Kotlin to Java code but the resulting Java code was full of errors.

Advertisement

Answer

Your assumptions are correct. GWT compiler works on Java sources. The error message it gives you is correct: There are no Java source code files to be found, you say it yourself that you used Kotlin.

If you want to use GWT, convert to correct Java source code.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement