GWT Compiler Error: Missing Interface Methods on Subclass (PlayN HTML)

允我心安 提交于 2019-12-05 06:35:39

This is your problem right here:

  [ERROR] <no source info>: public class com.deengames.BaseGame

You have put code in the top-level package com.deengames. I bet that your GWT module file is also in that same package directory, probably something like com/deengames/MyGame.gwt.xml. The GWT module file has to specify sub-package directories for all code that GWT will see.

When you generate a project using the PlayN Maven archetype, it has this structure:

core/src/main/java/com/foozle/core/Barzle.java
core/src/main/java/com/foozle/resources/images/bg.png
html/src/main/java/com/foozle/Barzle.gwt.xml
html/src/main/java/com/foozle/html/BarzleHtml.java

All of the game code is in the com.foozle.core package and the resources are in the com.foozle.resources package. If you look at the generated Barzle.gwt.xml file you will see:

<module rename-to='barzle'>
  <inherits name='playn.PlayN'/>
  <source path='core'/>
  <source path='html'/>
  <public path="resources" />
  <entry-point class='com.foozle.html.BarzleHtml'/>
</module>

The two <source> lines explicitly add the com.foozle.core and com.foozle.html sub-packages to the GWT project. Anything that is not explicitly listed in this GWT module file will be ignored by GWT. Due to the way GWT specifies these packages, it is not possible to add the top-level package to your GWT project. You cannot use:

<source path=""/>

or:

<source path="."/>

You have to put all of your code in sub-packages that are explicitly enumerated in your GWT module file.

I presume there is an issue with the BlahGame.gwt.xml file inclusions. Make sure all the directories are included in that file, as sources. The structure should be similar to:

<module rename-to='blah'>
  <inherits name='playn.PlayN' />

    <source path='core'/>
    <source path='common'/>
     ... etc ...
    <source path='html'/>

    <public path="resources" />

    <entry-point class='full.namespace.BlahGameHtml' />

</module>

Additionally, your BlahGameHtml.java class should look something like:

public class BlahGameHtml extends HtmlGame
{

    @Override
    public void start()
    {
        HtmlAssetManager assets = HtmlPlatform.register().assetManager();
        assets.setPathPrefix("blah/");
        PlayN.run(new BlahGame());
    }

}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!