"Cannot find symbol" error in Android compile

Monkey Targets Forums/Android/"Cannot find symbol" error in Android compile

Gerry Quinn(Posted 2011) [#1]
Hi,

I have a project that compiles and runs without a hitch in HTML5, GLFW and Flash. But on Android it stops with an error like so:

compile:
[javac] C:\DevPacks\Android\android-sdk\tools\ant\main_rules.xml:385: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 2 source files to C:\Dev\Monkey\Current\frazzle\frazzle.build\android\bin\classes
[javac] C:\Dev\Monkey\Current\frazzle\frazzle.build\android\src\com\monkey\MonkeyGame.java:3361: cannot find symbol
[javac] symbol : method bb_BlitRect3(com.monkey.bb_graphics_Image,com.monkey.bb_helperclasses_Point,com.monkey.bb_helperclasses_Rect)
[javac] location: class com.monkey.bb_tiles_TiledImage
[javac] bb_tiles.bb_BlitRect3(bb_tiles.bb_image,bbt_rect.bb_loc,bbt_tileRect);
[javac] ^

[in the output the caret at the bottom is under the dot after bb_tiles]

...and the same with three more functions called BlitRect() in tiles.monkey (a module containing graphics and sprite-type functions and classes)

I've tried to recreate this problem with a simpler program using the same functions, but it compiles and runs just fine on Android!

None of my filenames have spaces (something I saw mentioned as a possibility in another post).

Any ideas?


Gerry Quinn(Posted 2011) [#2]
I really don't get this. I looked at the generated Java source and the functions are in there as static public functions of a class called bb_Tiles which obviously just gathers together non-class functions in the Tiles module.

Yet javac insists it can't find the symbols. Seems like a bug in javac rather than Monkey?

When I put the functions in the .monkey files that use them and don't import Tiles, it works again.

I also tried changing the function names in case there is some clash, but that had no effect and anyway it wouldn't make any sense for several reasons.

Has anyone ever seen something like this?


therevills(Posted 2011) [#3]
Have you tried deleting your build folder and recompiling?

If so, you will either have to post the code here so we can help, or post it to Mark, or try again to recreate it in a small sample.


Gerry Quinn(Posted 2011) [#4]
Yes, I tried deleting the build folder more than once. I tried creating the problem in a small sample, but it didn't work. I may try making a copy of the project and deleting stuff.

If worse comes to worst I can work around the bug, but it's annoying.


skid(Posted 2011) [#5]
This looks a lot like this error

http://monkeycoder.co.nz/Community/posts.php?topic=1688#15801

where monkey is munging modules and variables with same prefix in android.

If my hunch is correct you will either need to rename your tiles module or the variable in your code named tiles.


Gerry Quinn(Posted 2011) [#6]
That fixed it! One of my classes had a field called tiles, which was an instance of the TiledImage class in the module called tiles - so that was probably the cause.

I changed the module name to tilesmod and it compiled without problems.

Thanks!