Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibGdx and Gwt : No source code is available for type

I'm trying to start my Html Project but i'm facing some problems. The desktop and Android projects work well. The problem is that I have an other project I use as a library that is not being imported or something.

[ERROR] [com.mobilecostudios.walkingskeleton.GwtDefinition] - Errors in 'file:/C:/Users/chelo/Documents/mobilecostudios-libgdx/trunk/walkingskeleton/WalkingSkeleton/src/com/mobilecostudios/walkingskeleton/GameLoop.java'
[ERROR] [com.mobilecostudios.walkingskeleton.GwtDefinition] - Line 21: No source code is available for type com.mobilecostudios.gamelibrary.Domain.BaseSprite; did you forget to inherit a required module?

My Project hierarchy is:

  • GameDevLibrary
  • WalkingSkeleton
  • WalkingSkeleton-html

My gwt.xml is:

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
    <inherits name='GameLoop' />
    <entry-point class='com.mobilecostudios.walkingskeleton.client.GwtLauncher' />
    <set-configuration-property name="gdx.assetpath" value="../WalkingSkeleton-android/assets" />
</module>

I have added the proyect to the build path already. What else am I missing?

Build Path enter image description here

like image 394
chelo_c Avatar asked Apr 14 '13 21:04

chelo_c


2 Answers

You have to make sure that you also add the project's source code to your path. Any GWT Java modules that will be used client side needs to have its source code available.

In your case,

<inherits name='GameLoop' />

Should be:

<inherits name='com.mobilecostudios.walkingskeleton.GameLoop' />

Also, where does com.mobilecostudios.gamelibrary.Domain.BaseSprite come from? If it's used client side you need to add it to the module .gwt.xml file. Should be something like:

<inherits name='com.mobilecostudios.gamelibrary.GameLibrary' />

Above, I am assuming that GameLibrary.gwt.xml is the GWT module XML file for the project that contains com.mobilecostudios.gamelibrary.Domain.BaseSprite.

Basically, when you want to use an external GWT module in your own project on the client side you need to import it into your project by adding the sources and binaries to your build path and you also need to add an <inherits name='...'> to your .gwt.xml file of your project.

like image 177
enrybo Avatar answered Sep 21 '22 16:09

enrybo


For projects that have more than one package you have to add an .gwt.xml for every package that you are using :
add an xml for every package

as you can see in above picture i add controller.gwt.xml for controller objects.gwt.xml for objects and so on ... and inside these .gwt.xml files you must write something like this :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module>
    <source path="com/me/controller" />
</module>

for example this is my controller.gwt.xml then add an inherit tag to your GwtDefinition.gwt.xml file like this :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
    <inherits name='MyGdxGame' />
    <inherits name='objects' />
    <inherits name='settings' />
    <inherits name='controller' />
    <entry-point class='com.me.mygdxgame.client.GwtLauncher' />
    <set-configuration-property name="gdx.assetpath" value="../cannongame-android/assets" />
</module>
like image 43
odyse Avatar answered Sep 22 '22 16:09

odyse