libgdx/gdx-ai

GWT is broken in version 1.7.0

bazola opened this issue · 12 comments

Looks like the cause is the new GdxFileSystem. Here is the output that I get when trying to compile for GWT:

16:00:58.902 [QUIET] [system.out]    Validating units:
16:00:58.906 [QUIET] [system.out]       [ERROR] Errors in 'jar:file:/Users/baz/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-ai/1.7.0/fedc63e153ddbd33ea94c1ed379f811c6688269d/gdx-ai-1.7.0-sources.jar!/com/badlogic/gdx/ai/GdxFileSystem.java'
16:00:58.906 [QUIET] [system.out]          [ERROR] Line 41: No source code is available for type com.badlogic.gdx.assets.loaders.resolvers.AbsoluteFileHandleResolver; did you forget to inherit a required module?
16:00:58.906 [QUIET] [system.out]          [ERROR] Line 49: No source code is available for type com.badlogic.gdx.assets.loaders.resolvers.LocalFileHandleResolver; did you forget to inherit a required module?
16:00:58.906 [QUIET] [system.out]       [ERROR] Errors in 'jar:file:/Users/baz/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-ai/1.7.0/fedc63e153ddbd33ea94c1ed379f811c6688269d/gdx-ai-1.7.0-sources.jar!/com/badlogic/gdx/ai/StandaloneFileSystem.java'
16:00:58.906 [QUIET] [system.out]          [ERROR] Line 69: The constructor FileHandle(String, Files.FileType) is undefined
16:00:58.906 [QUIET] [system.out]          [ERROR] Line 73: The constructor FileHandle(File, Files.FileType) is undefined
16:00:58.906 [QUIET] [system.out]          [ERROR] Line 77: file cannot be resolved
16:00:58.906 [QUIET] [system.out]          [ERROR] Line 77: type cannot be resolved to a variable
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 78: file cannot be resolved to a variable
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 78: type cannot be resolved to a variable
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 82: file cannot be resolved
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 83: file cannot be resolved
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 83: type cannot be resolved to a variable
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 87: file cannot be resolved
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 89: type cannot be resolved to a variable
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 94: type cannot be resolved to a variable
16:00:58.907 [QUIET] [system.out]          [ERROR] Line 98: type cannot be resolved to a variable
16:00:58.908 [QUIET] [system.out]          [ERROR] Line 98: file cannot be resolved
16:00:58.908 [QUIET] [system.out]          [ERROR] Line 99: type cannot be resolved to a variable
16:00:58.908 [QUIET] [system.out]          [ERROR] Line 99: file cannot be resolved
16:00:58.908 [QUIET] [system.out]          [ERROR] Line 100: file cannot be resolved to a variable
16:00:58.908 [QUIET] [system.out]       [ERROR] Errors in 'jar:file:/Users/baz/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-ai/1.7.0/fedc63e153ddbd33ea94c1ed379f811c6688269d/gdx-ai-1.7.0-sources.jar!/com/badlogic/gdx/ai/btree/utils/DistributionAdapters.java'
16:00:58.909 [QUIET] [system.out]          [ERROR] Line 463: The method countTokens() is undefined for the type StringTokenizer
16:00:58.950 [QUIET] [system.out]    Removing invalidated units
16:00:59.004 [QUIET] [system.out]       Compilation unit 'jar:file:/Users/baz/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-ai/1.7.0/fedc63e153ddbd33ea94c1ed379f811c6688269d/gdx-ai-1.7.0-sources.jar!/com/badlogic/gdx/ai/btree/utils/BehaviorTreeParser.java' is removed due to invalid reference(s):
16:00:59.004 [QUIET] [system.out]          com.badlogic.gdx.ai.btree.utils.DistributionAdapters
16:00:59.021 [QUIET] [system.out]       Compilation unit 'jar:file:/Users/baz/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-ai/1.7.0/fedc63e153ddbd33ea94c1ed379f811c6688269d/gdx-ai-1.7.0-sources.jar!/com/badlogic/gdx/ai/btree/utils/BehaviorTreeLibrary.java' is removed due to invalid reference(s):
16:00:59.022 [QUIET] [system.out]          com.badlogic.gdx.ai.btree.utils.BehaviorTreeParser
16:00:59.022 [QUIET] [system.out]       Compilation unit 'jar:file:/Users/baz/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-ai/1.7.0/fedc63e153ddbd33ea94c1ed379f811c6688269d/gdx-ai-1.7.0-sources.jar!/com/badlogic/gdx/ai/btree/utils/BehaviorTreeLoader.java' is removed due to invalid reference(s):
16:00:59.022 [QUIET] [system.out]          com.badlogic.gdx.ai.btree.utils.BehaviorTreeParser
16:00:59.041 [QUIET] [system.out]       Compilation unit 'jar:file:/Users/baz/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-ai/1.7.0/fedc63e153ddbd33ea94c1ed379f811c6688269d/gdx-ai-1.7.0-sources.jar!/com/badlogic/gdx/ai/btree/utils/BehaviorTreeLibraryManager.java' is removed due to invalid reference(s):
16:00:59.041 [QUIET] [system.out]          com.badlogic.gdx.ai.btree.utils.BehaviorTreeLibrary
16:00:59.217 [QUIET] [system.out] Wrote 3854 units to persistent cache.
16:01:00.628 [QUIET] [system.out]    Finding entry point classes
16:01:00.629 [QUIET] [system.out]    [ERROR] Aborting compile due to errors in some input files

Ok, looks like there are a few issues on GWT:

  1. As @MobiDevelop said on the irc channel, we should add AbsoluteFileHandleResolver and LocalFileHandleResolver to the libgdx GWT module.
  2. Add missing FileHandle constructors to the libgdx GWT module.
  3. StringTokenizer.countTokens() is not supported by GWT. This must be fixed in gdx-ai, I guess

Now items 1 and 2 should be fixed by this commit and this commit respectively

Just realized that StringTokenizer is emulated by the libgdx gwt backend, see https://github.com/libgdx/libgdx/blob/master/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/util/StringTokenizer.java

We might simply update that class in order to support countTokens.

Hi! I have this problem. How can I update my project to get your fixes?

@AlexanderSopov
Update to gdx-1.8.0.
If you use gradle, just change the gdx-ai version in your build.gradle.

@davebaol hi! I did do just that. In the build.gradle in the root folder of the project I changed the following thing:

allprojects{
[...]
ext{
appName = "SharpShooter"
gdxVersion = '1.8.0'
roboVMVersion = '1.12.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0' * >>it was 1.7.0 before<<*
}
}

and I still get the same error. Did I miss something? :(

Looks like you have not run gradle to refresh depencencies and rebuild your project.
You can do it either from inside your IDE or through command line.

@davebaol actually I got it working by changing ai-version to 1.6 so I doubt that refreshing dependencies will help, but I will try. Thanks a lot! :)

Yes, I did gradle build --refresh-dependencies and it did not help circumvent the issue. I still get an error with the exact error as the OP in this thread.

Try using these versions

gdxVersion = '1.9.2'
aiVersion = '1.8.0'

I had to change StringTokenizer emulation in libgdx 1.9.0, see the commit linked in #59 (comment)

@davebaol thanks man! That solved it! I had to make some changes to the htmlLauncher but that wasn't hard. 💃